mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
17e7776e16
commit
e952fe3517
10
tree.go
10
tree.go
@ -434,6 +434,9 @@ walk: // Outer loop for walking the tree
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is no handle for this route, but this route has a
|
||||||
|
// wildcard child, there must be a handle for this path with an
|
||||||
|
// additional trailing slash
|
||||||
if path == "/" && n.wildChild && n.nType != root {
|
if path == "/" && n.wildChild && n.nType != root {
|
||||||
value.tsr = true
|
value.tsr = true
|
||||||
return
|
return
|
||||||
@ -441,9 +444,8 @@ walk: // Outer loop for walking the tree
|
|||||||
|
|
||||||
// No handle found. Check if a handle for this path + a
|
// No handle found. Check if a handle for this path + a
|
||||||
// trailing slash exists for trailing slash recommendation
|
// trailing slash exists for trailing slash recommendation
|
||||||
indices := n.indices
|
for i, c := range []byte(n.indices) {
|
||||||
for i, max := 0, len(indices); i < max; i++ {
|
if c == '/' {
|
||||||
if indices[i] == '/' {
|
|
||||||
n = n.children[i]
|
n = n.children[i]
|
||||||
value.tsr = (len(n.path) == 1 && n.handlers != nil) ||
|
value.tsr = (len(n.path) == 1 && n.handlers != nil) ||
|
||||||
(n.nType == catchAll && n.children[0].handlers != nil)
|
(n.nType == catchAll && n.children[0].handlers != nil)
|
||||||
@ -563,7 +565,7 @@ walk: // Outer loop for walking the tree
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// findCaseInsensitivePath makes a case-insensitive lookup of the given path and tries to find a handler.
|
// Makes a case-insensitive lookup of the given path and tries to find a handler.
|
||||||
// It can optionally also fix trailing slashes.
|
// It can optionally also fix trailing slashes.
|
||||||
// It returns the case-corrected path and a bool indicating whether the lookup
|
// It returns the case-corrected path and a bool indicating whether the lookup
|
||||||
// was successful.
|
// was successful.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user