Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

nueko
Copy link

@nueko nueko commented Jun 16, 2017

No description provided.

@@ -2,12 +2,13 @@

var Promise = require('pouchdb-promise');
var urlJoin = require('url-join');
var parse = require('url-parse');
Copy link
Collaborator

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;
Copy link
Collaborator

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 ?

@ptitjes
Copy link
Collaborator

ptitjes commented Nov 11, 2017

Note: This surely would fix #150.

tlvince added a commit to tlvince/pouchdb-authentication that referenced this pull request Nov 15, 2017
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
tlvince added a commit that referenced this pull request Nov 15, 2017
@ptitjes
Copy link
Collaborator

ptitjes commented Nov 15, 2017

Superseded by #180 and #181. Closing.

@ptitjes ptitjes closed this Nov 15, 2017
ptitjes pushed a commit to ptitjes/pouchdb-authentication that referenced this pull request Nov 17, 2017
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
ptitjes pushed a commit to ptitjes/pouchdb-authentication that referenced this pull request Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants