We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While playing with URI.js, I stumbled across a problem. Here's some sample code to illustrate the point, as copied from my Chrome's script console.
URI(document.location).toString() "https:://example.com/somePage.html"
This seems to boil down to how URI handles the protocol.
URI(document.location).protocol() "https:" URI(document.location.toString()).protocol() "https" document.location.protocol "https:"
It looks like .protocol can contain a colon and that seems to mess up URI.build on line 365:
if (parts.protocol) { t += parts.protocol + ":"; }
I'm wondering if this would make sense:
if (parts.protocol && parts.protocol.charAt(parts.protocol.length - 1) != ':') { t += parts.protocol + ":"; }
The text was updated successfully, but these errors were encountered:
Nice catch!
URI(document.location).protocol() "https:" URI(document.location.toString()).protocol() "https"
gives away the reason for this: the former is an object, the latter is a string. While a string is parsed into its components, an object is not.
The problem is not with the .build() function, but with .href(). I'll look into this…
Sorry, something went wrong.
fixing issue #50 - URI(location) would lead to broken URL (bad protoc…
c027a6f
…ol, missing query, fragment)
Issue resolved with v1.8.0
No branches or pull requests
While playing with URI.js, I stumbled across a problem. Here's some sample code to illustrate the point, as copied from my Chrome's script console.
This seems to boil down to how URI handles the protocol.
It looks like .protocol can contain a colon and that seems to mess up URI.build on line 365:
I'm wondering if this would make sense:
The text was updated successfully, but these errors were encountered: