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

Host is dropped if path contains colon #84

Closed
felixfbecker opened this issue Apr 27, 2017 · 2 comments
Closed

Host is dropped if path contains colon #84

felixfbecker opened this issue Apr 27, 2017 · 2 comments

Comments

@felixfbecker
Copy link

felixfbecker commented Apr 27, 2017

file:// URLs on Windows typically do not %-encode the colon after the drive letter. When building such URIs, this library drops the host of the base (I assume because it reads it as a port?)

Expected, Chrome:

new URL('/c:/baz/qux', 'file://host/foo/bar').href
"file://host/c:/baz/qux"

Actual, whatwg-url:

new URL('/c:/baz/qux', 'file://host/foo/bar').href
"file:///c:/baz/qux"

It actually happens even when you just set pathname to anything with a colon:

const uri = new URL('file://host/foo')
uri.host // 'host'
uri.pathname = '/c:/bar'
uri.host // ''
@felixfbecker felixfbecker changed the title Host of base is not used if path has colon Host is dropped if path contains colon Apr 27, 2017
@Sebmaster
Copy link
Member

Looks to me like that is because in the URL spec in the path state instruction 1.4.1.1 does not use the base URL host.

Open a bug in the official repo if you think that's a bug in the spec.
Closing because I don't think that's a bug in whatwg-url, but can reopen if you think I followed the spec wrong.

@felixfbecker
Copy link
Author

Opened whatwg/url#302

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

2 participants