mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
Fix conflict between param and exact path
Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>
This commit is contained in:
parent
c0418c48e4
commit
801d7b3bd6
8
tree.go
8
tree.go
@ -411,10 +411,16 @@ walk: // Outer loop for walking the tree
|
|||||||
idxc := path[0]
|
idxc := path[0]
|
||||||
for i, c := range []byte(n.indices) {
|
for i, c := range []byte(n.indices) {
|
||||||
if c == idxc {
|
if c == idxc {
|
||||||
n = n.children[i]
|
childWillWalkTo := n.children[i]
|
||||||
|
|
||||||
|
if strings.Split(childWillWalkTo.path, "/")[0] != strings.Split(path, "/")[0] && strings.HasPrefix(n.children[len(n.children)-1].path, ":") {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
n = childWillWalkTo
|
||||||
continue walk
|
continue walk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If there is no wildcard pattern, recommend a redirection
|
// If there is no wildcard pattern, recommend a redirection
|
||||||
if !n.wildChild {
|
if !n.wildChild {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user