Only add a slash to path if it's a separator between
a host and path.
Fixes #6609
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/
14815043
buf.WriteString(h)
}
}
- if u.Path != "" && u.Path[0] != '/' {
+ if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
buf.WriteByte('/')
}
buf.WriteString(escape(u.Path, encodePath))
},
"mailto:webmaster@golang.org",
},
+ // Relative path
+ {
+ "a/b/c",
+ &URL{
+ Path: "a/b/c",
+ },
+ "a/b/c",
+ },
}
// more useful string for debugging than fmt's struct printer