Escape troublesome characters in relativePath when returning Resource URL. #74

wants to merge 1 commit into


None yet
2 participants

monowerker commented Aug 6, 2013

PR adds escaping of forward slashes and colon in relativePath before returning the URL, so that they can be used as a delimiter in database-names and document ids. Seems to work... but I'm somewhat uncertain if this introduces any regressions and what characters are favorable to escape.


snej commented Aug 9, 2013

Couple of small issues. Also, have you tested this with database and document IDs containing other special characters?

Escape URI reserved characters in relativePath when returning Resourc…
…e URLs.

Escapes reserved characters in RFC 3986 section 2.2.

CouchDesignDocument and CouchQuery overrides the URL generation to handle '_design/' and '_view/' prefixes in relativePath that needs to be left unescaped.

monowerker commented Aug 10, 2013

Thanks for the feedback. This is working for our use case but it needs some more work to be a generally working solution.

I've coded up a small test project at

Currently, escaped queries with startKey & endKey seem to work and getting by _id. There are still issues with views and replication, I'll have a look at updating the PR with fixes for those when I have some time.


snej commented Aug 11, 2013

Keep in mind that I consider TouchDB and CouchCocoa to be in maintenance mode; most new development is going on in Couchbase Lite (which doesn't have this issue with slashes in db names because the commands don't go through a REST API.)


monowerker commented Aug 12, 2013

Right, but would it still make sense to add escaping to CouchCocoa for interacting with CouchDB/Couchbase Server?


snej commented Aug 12, 2013

Yes, you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment