Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Slashes in database names not correctly escaped #70

Open
sander opened this issue May 25, 2013 · 1 comment
Open

Slashes in database names not correctly escaped #70

sander opened this issue May 25, 2013 · 1 comment

Comments

@sander
Copy link

sander commented May 25, 2013

When a TouchDB database URL contains forward slashes, they don’t seem to be properly escaped to %2F by CouchCocoa. My code rougly looks like this:

id name = @"lunacy/user/sander";
CouchTouchDBServer *server = [CouchTouchDBServer sharedInstance];
_db = [server databaseNamed:local];
[_db create];
CouchQuery *query = [_db getAllDocuments];
_live = [query asLiveQuery];
[_live setPrefetch:YES];
[_live setSequences:YES];
[_live start];
[_live wait];

The log with gRESTLogLevel = kRESTLogRequestURLs looks like this:

2013-05-25 23:13:11.715 Lunacy[51365:c07] REST: >> PUT touchdb:///lunacy/user/sander
2013-05-25 23:13:11.716 Lunacy[51365:c07] REST: >> GET touchdb:///lunacy/user/sander/_design/general
2013-05-25 23:13:11.718 Lunacy[51365:c07] REST: << 404 for PUT touchdb:///lunacy/user/sander (34 bytes)
2013-05-25 23:13:11.719 Lunacy[51365:c07] REST: << 404 for GET touchdb:///lunacy/user/sander/_design/general (34 bytes)
2013-05-25 23:13:11.720 Lunacy[51365:c07] REST: Blocked for 2.7 ms in RESTOperation[failed  GET touchdb:///lunacy/user/sander/_design/general]
[…]
2013-05-25 23:13:11.726 Lunacy[51365:c07] REST: >> GET touchdb:///_replicator/_all_docs?include_docs=true&update_seq=true
2013-05-25 23:13:11.729 Lunacy[51365:c07] REST: << 200 for GET touchdb:///_replicator/_all_docs?include_docs=true&update_seq=true (2094 bytes)
[…]
2013-05-25 23:13:11.734 Lunacy[51365:c07] REST: >> GET touchdb:///lunacy/user/sander/_all_docs?update_seq=true&include_docs=true&local_seq=true
2013-05-25 23:13:11.735 Lunacy[51365:c07] REST: << 404 for GET touchdb:///lunacy/user/sander/_all_docs?update_seq=true&include_docs=true&local_seq=true (34 bytes)
2013-05-25 23:13:11.737 Lunacy[51365:c07] WARNING: CouchLiveQuery[_all_docs] failed with Error Domain=CouchDB Code=404 "The operation couldn’t be completed. not_found" UserInfo=0x92a3940 {NSUnderlyingError=0x928c3a0 "not found", NSLocalizedFailureReason=not_found}

It works when changing the slashes to e.g. underscores.

@monowerker
Copy link
Contributor

#74

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants