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

Encode percent(%)s that are not part of a percent-encoded byte when parsing a URL #170

Closed
duanyao opened this issue Dec 8, 2016 · 1 comment

Comments

@duanyao
Copy link

duanyao commented Dec 8, 2016

Test case:

console.log(new URL('/%n', document.baseURI).pathname); // -> /%n

This is surperising to me, because I expect that the URL constructor either fail or return a valid url; however, '/%n' is not a valid url. If you feed '/%n' to decodeURI(), it will throw a URIError.

The spec just say that a percent that is not a part of a percent-encoded byte is a "syntax violation", but does not require the parser to throw or to fix the syntax.

I suggest encode percent(%)s that are not part of a percent-encoded byte when parsing a URL, i.e. '/%n' becomes '/%25n' after parsing.

@annevk
Copy link
Member

annevk commented Dec 8, 2016

This is a duplicate of #87. It's a little unclear what we can effectively change here.

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