forked from elixir-lang/elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve slashes in URIs without authority (elixir-lang#9632)
Old behavior: to_string(URI.parse("file:///path")) == "file:/path" New behavior: to_string(URI.parse("file:///path")) == "file:///path"
- Loading branch information
Showing
2 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,13 +116,13 @@ defmodule URITest do | |
test "works with \"file\" scheme" do | ||
expected_uri = %URI{ | ||
scheme: "file", | ||
host: nil, | ||
host: "", | ||
path: "/foo/bar/baz", | ||
userinfo: nil, | ||
query: nil, | ||
fragment: nil, | ||
port: nil, | ||
authority: nil | ||
authority: "" | ||
} | ||
|
||
assert URI.parse("file:///foo/bar/baz") == expected_uri | ||
|
@@ -179,8 +179,8 @@ defmodule URITest do | |
test "works with LDAP scheme" do | ||
expected_uri = %URI{ | ||
scheme: "ldap", | ||
host: nil, | ||
authority: nil, | ||
host: "", | ||
authority: "", | ||
userinfo: nil, | ||
path: "/dc=example,dc=com", | ||
query: "?sub?(givenName=John)", | ||
|
@@ -331,6 +331,9 @@ defmodule URITest do | |
assert to_string(URI.parse("http://google.com")) == "http://google.com" | ||
assert to_string(URI.parse("http://google.com:443")) == "http://google.com:443" | ||
assert to_string(URI.parse("https://google.com:443")) == "https://google.com" | ||
assert to_string(URI.parse("file:/path")) == "file:/path" | ||
assert to_string(URI.parse("file:///path")) == "file:///path" | ||
assert to_string(URI.parse("file://///path")) == "file://///path" | ||
assert to_string(URI.parse("http://lol:[email protected]")) == "http://lol:[email protected]" | ||
assert to_string(URI.parse("http://google.com/elixir")) == "http://google.com/elixir" | ||
assert to_string(URI.parse("http://google.com?q=lol")) == "http://google.com?q=lol" | ||
|