mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 13:02:14 +08:00
fixed open redirect
This commit is contained in:
parent
6c8ec4deda
commit
29db90e1fc
2
gin.go
2
gin.go
@ -699,7 +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, "/")
|
p = regexp.MustCompile("^/{2,}").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