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

URL: percent encode in fragments #4298

Merged
merged 2 commits into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions url/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1118,21 +1118,21 @@
}
},
{
"comment": "No percent-encoding at all (!); nuls, tabs, and newlines are removed",
"comment": "Simple percent-encoding; nuls, tabs, and newlines are removed",
"href": "a:/",
"new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
"expected": {
"href": "a:/#\u0001\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
"hash": "#\u0001\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé"
"href": "a:/#%01%1F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~%7F%7F%C2%80%C2%81%C3%89%C3%A9",
"hash": "#%01%1F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~%7F%7F%C2%80%C2%81%C3%89%C3%A9"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is %7F%7F really correct here? whatwg-url would only encode one %7F.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, let me fix that.

}
},
{
"comment": "Bytes already percent-encoded are left as-is",
"href": "http://example.net",
"new_value": "%c3%89té",
"expected": {
"href": "http://example.net/#%c3%89té",
"hash": "#%c3%89té"
"href": "http://example.net/#%c3%89t%C3%A9",
"hash": "#%c3%89t%C3%A9"
}
}
]
Expand Down
12 changes: 6 additions & 6 deletions url/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@
{
"input": "#β",
"base": "http://example.org/foo/bar",
"href": "http://example.org/foo/bar#β",
"href": "http://example.org/foo/bar#%CE%B2",
"origin": "http://example.org",
"protocol": "http:",
"username": "",
Expand All @@ -1302,7 +1302,7 @@
"port": "",
"pathname": "/foo/bar",
"search": "",
"hash": "#β"
"hash": "#%CE%B2"
},
{
"input": "data:text/html,test#test",
Expand Down Expand Up @@ -2161,7 +2161,7 @@
{
"input": "http://www.google.com/foo?bar=baz# »",
"base": "about:blank",
"href": "http://www.google.com/foo?bar=baz# »",
"href": "http://www.google.com/foo?bar=baz# %C2%BB",
"origin": "http://www.google.com",
"protocol": "http:",
"username": "",
Expand All @@ -2171,12 +2171,12 @@
"port": "",
"pathname": "/foo",
"search": "?bar=baz",
"hash": "# »"
"hash": "# %C2%BB"
},
{
"input": "data:test# »",
"base": "about:blank",
"href": "data:test# »",
"href": "data:test# %C2%BB",
"origin": "null",
"protocol": "data:",
"username": "",
Expand All @@ -2186,7 +2186,7 @@
"port": "",
"pathname": "test",
"search": "",
"hash": "# »"
"hash": "# %C2%BB"
},
{
"input": "http://[www.google.com]/",
Expand Down