mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 04:57:07 +08:00
fixed open redirect
This commit is contained in:
parent
7a865dcf1d
commit
6c8ec4deda
1
gin.go
1
gin.go
@ -699,6 +699,7 @@ func redirectTrailingSlash(c *Context) {
|
|||||||
p = prefix + "/" + req.URL.Path
|
p = prefix + "/" + req.URL.Path
|
||||||
}
|
}
|
||||||
req.URL.Path = p + "/"
|
req.URL.Path = p + "/"
|
||||||
|
p = regRemoveRepeatedChar.ReplaceAllString(p, "/")
|
||||||
if length := len(p); length > 1 && p[length-1] == '/' {
|
if length := len(p); length > 1 && p[length-1] == '/' {
|
||||||
req.URL.Path = p[:length-1]
|
req.URL.Path = p[:length-1]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user