-
Notifications
You must be signed in to change notification settings - Fork 474
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
URI with no host and no leading slash in path creates a host #387
Comments
I'm inclined to call this a bug. I'd say https://github.com/medialize/URI.js/blob/gh-pages/src/URI.js#L684 should be changed to if (parts.path.charAt(0) !== '/' && t) { |
thanks for reporting this! It's fixed and released as 1.19.2 |
Hi @rodneyrehm Do you really think this is a valid change? With version // https://host.com/something
const urijs1 = require("urijs@1.19.1")
const uri1 = urijs1('host.com/something').scheme('https').href()
// https:///host.com/something
const urijs2 = require("urijs@1.19.2")
const uri2 = urijs2('host.com/something').scheme('https').href() |
Grüezi @DaRaFF ;) unfortunately I do believe the change is valid. What you're describing is another bug that was previously hidden by the first,
Maybe it's time to revisit #260 (and the unfinished attempt at providing a solution: #374) and provide a proper API for what you're trying to do… Are you looking to get your hands dirty with this? |
I have code that looks like
I expected
uri
to befood:///test/file.csv
, but it'sfood://test/file.csv
.When re-parsing
uri
thehost
is nowtest
andpath
has changed fromtest/file.csv
to/file.csv
.Is this expected, and if so, should I ensure my
path
has a leading slash? Or, is this unexpected behaviour in the library?Thanks for this library, and for your time!
The text was updated successfully, but these errors were encountered: