-
Notifications
You must be signed in to change notification settings - Fork 117
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
using url-parse in getBaseUrl #160
Conversation
@@ -2,12 +2,13 @@ | |||
|
|||
var Promise = require('pouchdb-promise'); | |||
var urlJoin = require('url-join'); | |||
var parse = require('url-parse'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you call the function urlParse
for symmetry ?
} else { // pouchdb post-6.0.0 | ||
return db.name.replace(/\/[^\/]+\/?$/, ''); | ||
return parse(db.__opts && db.__opts.prefix || db.name).origin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added a db.__opts && db.__opts.prefix
case. What does it add compared to db.name
?
Note: This surely would fix #150. |
If [PouchDB.defaults][1] is used, its options are attached to `__.opts`. In the case of `PouchDB.defaults({prefix: ''})`: > `prefix` appends a prefix to the database name and can be helpful for > URL-based or file-based LevelDOWN path names. For example: `{prefix: 'https://example.com/', name: 'test'}` would produce a DB "name" of `https://example.com/test`. Before, prefix was not respected. Closes pouchdb-community#158. Connects pouchdb-community#160. [1]: https://pouchdb.com/api.html#defaults
If [PouchDB.defaults][1] is used, its options are attached to `__.opts`. In the case of `PouchDB.defaults({prefix: ''})`: > `prefix` appends a prefix to the database name and can be helpful for > URL-based or file-based LevelDOWN path names. For example: `{prefix: 'https://example.com/', name: 'test'}` would produce a DB "name" of `https://example.com/test`. Before, prefix was not respected. Closes pouchdb-community#158. Connects pouchdb-community#160. [1]: https://pouchdb.com/api.html#defaults
Reimplements pouchdb-community#160. Closes pouchdb-community#150. Closes pouchdb-community#160.
No description provided.