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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

monowerker
Copy link
Contributor

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
Copy link
Contributor

snej commented Aug 9, 2013

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

…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
Copy link
Contributor Author

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 https://github.com/monowerker/CouchPrefixed

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
Copy link
Contributor

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
Copy link
Contributor Author

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

@snej
Copy link
Contributor

snej commented Aug 12, 2013

Yes, you're right.

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

Successfully merging this pull request may close these issues.

2 participants