medialize / URI.js

Javascript URL mutation library
http://medialize.github.io/URI.js/
MIT License
6.26k stars 474 forks source link

Different results between 1.19.1 and 1.19.2 when using uri.scheme #391

Open neil-morrison44 opened 5 years ago

neil-morrison44 commented 5 years ago

When running

  const uri = urijs(href)
  console.log(href, defaultScheme)
  uri.scheme(defaultScheme)
  console.log(uri.toString())

in version 1.19.1 the console reads:

example.com https
https://example.com

Which is what's intended, however, in version 1.19.2 it reads:

example.com https
https:///example.com

looks like there's an extra / getting in there somehow?

rodneyrehm commented 5 years ago

duplicate of #390

neil-morrison44 commented 5 years ago

I've now read through https://github.com/medialize/URI.js/issues/390

If this came as part of a major version release where it was documented that protocol-less URLs would be interpreted as relative paths that'd be fine - but as a patch it seems like a bug that's affecting how people are using the library (rightly or wrongly)

dcsaszar commented 4 years ago

Unfortunately this change also breaks our lib (https://www.npmjs.com/package/scrivito). We use the following dependency: "urijs": "^1.19.1".

With that said, from my potentially biased point of view, I agree with @neil-morrison44: This change would better be released in a major version update (2.x). I'd also like to see a 1.19.3 with this change reverted.

Some more detail:

This issue has a very subtle consequence in our case: While some IE11, and all other browsers treat the triple slash like a double slash, some IE11 fail with Unable to connect to the target server (see http://szborows.blogspot.com/2014/12/angularjs-cors-ie11-invalid-url.html)

simskij commented 4 years ago

Still no rollback of this change? This is in no way a patch but a breaking change.