File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1193,7 +1193,7 @@ func (u *URL) UnmarshalBinary(text []byte) error {
1193
1193
func (u * URL ) JoinPath (elem ... string ) * URL {
1194
1194
url := * u
1195
1195
if len (elem ) > 0 {
1196
- elem = append ([]string {u .Path }, elem ... )
1196
+ elem = append ([]string {u .EscapedPath () }, elem ... )
1197
1197
p := path .Join (elem ... )
1198
1198
// path.Join will remove any trailing slashes.
1199
1199
// Preserve at least one.
Original file line number Diff line number Diff line change @@ -2119,6 +2119,16 @@ func TestJoinPath(t *testing.T) {
2119
2119
elem : nil ,
2120
2120
out : "https://go.googlesource.com/" ,
2121
2121
},
2122
+ {
2123
+ base : "https://go.googlesource.com/a%2fb" ,
2124
+ elem : []string {"c" },
2125
+ out : "https://go.googlesource.com/a%2fb/c" ,
2126
+ },
2127
+ {
2128
+ base : "https://go.googlesource.com/a%2fb" ,
2129
+ elem : []string {"c%2fd" },
2130
+ out : "https://go.googlesource.com/a%2fb/c%2fd" ,
2131
+ },
2122
2132
{
2123
2133
base : "/" ,
2124
2134
elem : nil ,
You can’t perform that action at this time.
0 commit comments