Skip to content

Commit

Permalink
URL: protocol needs to be more restrictive around "file"
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored Mar 15, 2017
1 parent 01173e9 commit e48dd15
Showing 1 changed file with 66 additions and 0 deletions.
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://test@example.net",
"new_value": "file",
"expected": {
"href": "http://test@example.net/",
"protocol": "http:"
}
},
{
"href": "gopher://example.net:1234",
"new_value": "file",
"expected": {
"href": "gopher://example.net:1234/",
"protocol": "gopher:"
}
},
{
"href": "wss://x:x@example.net:1234",
"new_value": "file",
"expected": {
"href": "wss://x:x@example.net: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

0 comments on commit e48dd15

Please sign in to comment.