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

getBaseUrl removes the actual url #150

Closed
danielo515 opened this issue Apr 29, 2017 · 0 comments
Closed

getBaseUrl removes the actual url #150

danielo515 opened this issue Apr 29, 2017 · 0 comments

Comments

@danielo515
Copy link

danielo515 commented Apr 29, 2017

Hello,

I think this is a bug. One that is preventing me from using the plugin at all.

This is your getBaseUrl function from your utils:

function getBaseUrl(db) {
  if (typeof db.getUrl === 'function') { // pouchdb pre-6.0.0
    return db.getUrl().replace(/\/[^\/]+\/?$/, '');
  } else { // pouchdb post-6.0.0
    return db.name.replace(/\/[^\/]+\/?$/, '');
  }
}

Since I'm using pouchdb post-6.0.0 the second regex applies.

See what happens when I apply that replace to my connection url

"https://danielo515.cloudant.com/".replace(/\/[^\/]+\/?$/, '')
// Becomes "https:/"
// So requests are made to "https://_users/org.couchdb.user%3ABruce"

very stupid but annoying bug.

tlvince added a commit that referenced this issue Nov 15, 2017
ptitjes added a commit to ptitjes/pouchdb-authentication that referenced this issue Nov 17, 2017
The authentication tests were mixed in with urls tests. Also, the
url tests were enhanced to take in account use of urlParse and
handling of db prefixes. (cf. pouchdb-community#150 and pouchdb-community#158)
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

No branches or pull requests

1 participant