From e0c3f7978b54f3cf805d885f69a3aa1942a819ac Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 10 May 2020 12:05:39 +0800 Subject: [PATCH] refactor Signed-off-by: Bo-Yi Wu --- tree.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tree.go b/tree.go index ace1c33a..e3aa9190 100644 --- a/tree.go +++ b/tree.go @@ -710,7 +710,9 @@ walk: // Outer loop for walking the tree if n.handlers != nil { return ciPath - } else if fixTrailingSlash && len(n.children) == 1 { + } + + if fixTrailingSlash && len(n.children) == 1 { // No handle found. Check if a handle for this path + a // trailing slash exists n = n.children[0] @@ -718,6 +720,7 @@ walk: // Outer loop for walking the tree return append(ciPath, '/') } } + return nil case catchAll: