fix: only add slash if path is empty
This commit is contained in:
parent
c5b0865977
commit
60e917120d
|
@ -139,8 +139,12 @@ func replacePrefix(prefix string, h http.Handler) http.Handler {
|
|||
p := strings.TrimPrefix(r.URL.Path, prefix)
|
||||
rp := strings.TrimPrefix(r.URL.RawPath, prefix)
|
||||
if len(p) < len(r.URL.Path) && (r.URL.RawPath == "" || len(rp) < len(r.URL.RawPath)) {
|
||||
p += "/"
|
||||
rp += "/"
|
||||
if len(p) == 0 {
|
||||
p = "/"
|
||||
}
|
||||
if len(rp) == 0 {
|
||||
rp = "/"
|
||||
}
|
||||
r2 := new(http.Request)
|
||||
*r2 = *r
|
||||
r2.URL = new(url.URL)
|
||||
|
|
Loading…
Reference in New Issue