New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PouchDB wrongly flags + as illegal character for database name #4314
Comments
This error is just passed through from CouchDB in this instance. It will work if you percent-encode the +:
|
I am fairly sure we purposefully dont url encode the database name, but I cant quite think of why right now |
Nope, cant think of any reason to not do this |
fixed in 94c7276 |
This breaks things when a database name contains a Before this change we could work with database names like this, but not now. Consider a CouchDB server being served in a subdirectory (ie: // pre 5.1.0 this worked, now it gets double encoded
var db = new PouchDB('http://foo.com/_couch/user%2Fbar');
// now, without encoding PouchDB will think `bar` is the database name
var db = new PouchDB('http://foo.com/_couch/user/bar'); This is because // Split the path part of the URI into parts using '/' as the delimiter
// after removing any leading '/' and any trailing '/'
var parts = uri.path.replace(/(^\/|\/$)/g, '').split('/');
// Store the first part as the database name and remove it from the parts
// array
uri.db = encodeURIComponent(parts.pop()); A possible solution would be to check for the presence of uri.db = parts.pop();
if (uri.db.indexOf('%') === -1) {
uri.db = encodeURIComponent(uri.db);
} I will send PR shortly. cc/ @daleharvey |
Responds...
The text was updated successfully, but these errors were encountered: