Skip to content

Commit

Permalink
fix checks error
Browse files Browse the repository at this point in the history
  • Loading branch information
qm012 committed Jul 5, 2021
1 parent 5dbe044 commit 23f6238
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ walk: // Outer loop for walking the tree
n = n.children[i]

// match '/', If this condition is matched, the next route is found
if len(n.fullPath) != 0 && n.wildChild {
if (len(n.fullPath) != 0 && n.wildChild) || strings.HasSuffix(path, "/") {
matchNum++
}
continue walk
Expand Down Expand Up @@ -609,7 +609,9 @@ walk: // Outer loop for walking the tree

// Nothing found. We can recommend to redirect to the same URL with an
// extra trailing slash if a leaf exists for that path
// tree.go line:569 handle leaf nodes
value.tsr = (path == "/") ||
(len(prefix) == len(path)+1 && prefix[len(path)] == '/' &&
path == prefix[:len(prefix)-1] && n.handlers != nil)
return
}
}
Expand Down

0 comments on commit 23f6238

Please sign in to comment.