mirror of
https://github.com/golang/go
synced 2024-11-21 21:34:40 -07:00
fix reverse proxy issue by returning if the url is blank allowing for direct path reverse proxies instead of appending another slash unnecessarily
This commit is contained in:
parent
b357b05b70
commit
e7c3bb5f7c
@ -108,6 +108,9 @@ func singleJoiningSlash(a, b string) string {
|
||||
case aslash && bslash:
|
||||
return a + b[1:]
|
||||
case !aslash && !bslash:
|
||||
if b == "" {
|
||||
return a
|
||||
}
|
||||
return a + "/" + b
|
||||
}
|
||||
return a + b
|
||||
|
@ -1497,7 +1497,8 @@ func TestSingleJoinSlash(t *testing.T) {
|
||||
{"https://www.google.com/", "/favicon.ico", "https://www.google.com/favicon.ico"},
|
||||
{"https://www.google.com", "/favicon.ico", "https://www.google.com/favicon.ico"},
|
||||
{"https://www.google.com", "favicon.ico", "https://www.google.com/favicon.ico"},
|
||||
{"https://www.google.com", "", "https://www.google.com/"},
|
||||
{"https://www.google.com", "", "https://www.google.com"},
|
||||
{ "https://www.google.com/favicon.ico", "", "https://www.google.com/favicon.ico"},
|
||||
{"", "favicon.ico", "/favicon.ico"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user