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: protocol setter needs to be more restrictive for "file" #5112

Merged
merged 2 commits into from
Mar 15, 2017
Merged
Changes from all commits
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
66 changes: 66 additions & 0 deletions url/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,56 @@
"protocol": "a:"
}
},
{
"comment": "Can’t switch from URL containing username/password/port to file",
"href": "http://[email protected]",
"new_value": "file",
"expected": {
"href": "http://[email protected]/",
"protocol": "http:"
}
},
{
"href": "gopher://example.net:1234",
"new_value": "file",
"expected": {
"href": "gopher://example.net:1234/",
"protocol": "gopher:"
}
},
{
"href": "wss://x:[email protected]:1234",
"new_value": "file",
"expected": {
"href": "wss://x:[email protected]:1234/",
"protocol": "wss:"
}
},
{
"comment": "Can’t switch from file URL with no host",
"href": "file://localhost/",
"new_value": "http",
"expected": {
"href": "file:///",
"protocol": "file:"
}
},
{
"href": "file:///test",
"new_value": "gopher",
"expected": {
"href": "file:///test",
"protocol": "file:"
}
},
{
"href": "file:",
"new_value": "wss",
"expected": {
"href": "file:///",
"protocol": "file:"
}
},
{
"comment": "Can’t switch from special scheme to non-special",
"href": "http://example.net",
Expand All @@ -118,6 +168,14 @@
"protocol": "http:"
}
},
{
"href": "file://hi/path",
"new_value": "s",
"expected": {
"href": "file://hi/path",
"protocol": "file:"
}
},
{
"href": "https://example.net",
"new_value": "s",
Expand Down Expand Up @@ -168,6 +226,14 @@
"protocol": "ssh:"
}
},
{
"href": "ssh://example.net",
"new_value": "file",
"expected": {
"href": "ssh://example.net",
"protocol": "ssh:"
}
},
{
"href": "nonsense:///test",
"new_value": "https",
Expand Down