mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 09:34:33 +08:00
修改获取relativePath
This commit is contained in:
parent
edc547beaa
commit
fa7c11124a
3
tree.go
3
tree.go
@ -8,6 +8,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Param is a single URL parameter, consisting of a key and a value.
|
// Param is a single URL parameter, consisting of a key and a value.
|
||||||
@ -379,12 +380,12 @@ walk: // Outer loop for walking the tree
|
|||||||
// If this node does not have a wildcard (param or catchAll)
|
// If this node does not have a wildcard (param or catchAll)
|
||||||
// child, we can just look up the next child node and continue
|
// child, we can just look up the next child node and continue
|
||||||
// to walk down the tree
|
// to walk down the tree
|
||||||
|
relativePath+=n.path
|
||||||
if !n.wildChild {
|
if !n.wildChild {
|
||||||
c := path[0]
|
c := path[0]
|
||||||
for i := 0; i < len(n.indices); i++ {
|
for i := 0; i < len(n.indices); i++ {
|
||||||
if c == n.indices[i] {
|
if c == n.indices[i] {
|
||||||
n = n.children[i]
|
n = n.children[i]
|
||||||
relativePath+=n.path
|
|
||||||
continue walk
|
continue walk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user