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

Serialization of file URLs is wrong #52

Closed
domenic opened this issue Jul 28, 2015 · 4 comments
Closed

Serialization of file URLs is wrong #52

domenic opened this issue Jul 28, 2015 · 4 comments

Comments

@domenic
Copy link
Member

domenic commented Jul 28, 2015

https://url.spec.whatwg.org/#concept-url-serializer serializes file URLs as file:<path>, e.g. file:/foo/bar. They should be serialized as file:///foo/bar.

Related: jsdom/whatwg-url#22 web-platform-tests/wpt#2038

@domenic
Copy link
Member Author

domenic commented Jul 28, 2015

The patch that gives the expected results is

  if (url.scheme === "file" && url.host === null) {
    output += "//";
  }

after the current step 2 of https://url.spec.whatwg.org/#concept-url-serializer

@domenic
Copy link
Member Author

domenic commented Jul 28, 2015

Note: browser are inconsistent on the parsing of file URLs. Some parse file:/foo/bar as having foo as the host.

However, the spec does not (it puts foo in the path, making the path /foo/bar).

And, all implementations agree that file URLs with no host should be serialized with three slashes.

@annevk
Copy link
Member

annevk commented Jul 29, 2015

Thanks, I totally neglected file URLs when adding support for everything-can-be-a-relative-URL-scheme. Hopefully soon there is some time to fix the remaining file URL issues.

annevk added a commit that referenced this issue Aug 14, 2015
In particular, this should fix:
* annevk/url#1
* #52
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=23550
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=26341

It does not introduce a global mode-switch for Windows vs Unix parsing
behavior. I remain hopeful we can cross that gap.
@annevk
Copy link
Member

annevk commented Aug 14, 2015

This should be fixed now.

@annevk annevk closed this as completed Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants