Merge pull request #949 from harshavardhana/pr_out_add_path_to_if_path_is_null_string
This commit is contained in:
@@ -33,7 +33,7 @@ func (s *MySuite) TestURLParse(c *C) {
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(u.Scheme, Equals, "http")
|
||||
c.Assert(u.Host, Equals, "s3.example.com")
|
||||
c.Assert(u.Path, Equals, "")
|
||||
c.Assert(u.Path, Equals, "/")
|
||||
|
||||
u, err = Parse("http://s3.example.com/path/new")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
@@ -90,6 +90,9 @@ func Parse(urlStr string) (*URL, error) {
|
||||
if strings.HasPrefix(rest, "//") {
|
||||
// if rest has '//' prefix, skip them
|
||||
authority, rest := splitSpecial(rest[2:], "/", false)
|
||||
if rest == "" {
|
||||
rest = "/"
|
||||
}
|
||||
host := getHost(authority)
|
||||
if host != "" && (scheme == "http" || scheme == "https") {
|
||||
return &URL{
|
||||
|
||||
Reference in New Issue
Block a user