fix the misplacement of adding slashes (#2847)

This commit is contained in:
市民233
2021-10-26 18:15:29 +08:00
committed by GitHub
parent eb75ce0ff5
commit 1c2aa59b20
2 changed files with 17 additions and 1 deletions
+2 -1
View File
@@ -634,7 +634,8 @@ 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
value.tsr = path == "/" ||
(len(prefix) == len(path)+1 && n.handlers != nil)
(len(prefix) == len(path)+1 && prefix[len(path)] == '/' &&
path == prefix[:len(prefix)-1] && n.handlers != nil)
return
}
}