From 028cb5508faae0cbe2e798b25543bb8ebe0d96e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E6=AC=A7?= Date: Wed, 20 Feb 2019 16:25:26 +0800 Subject: [PATCH] Update tree.go --- tree.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tree.go b/tree.go index 4ee67d92..1484107c 100644 --- a/tree.go +++ b/tree.go @@ -187,9 +187,11 @@ func (n *node) addRoute(path string, handlers HandlersChain) { numParams-- // Check if the wildcard matches - if len(path) >= len(n.path) && n.path == path[:len(n.path)] && (len(n.path) >= len(path) || path[len(n.path)] == '/') { + if len(path) >= len(n.path) && n.path == path[:len(n.path)] { // check for longer wildcard, e.g. :name and :names - continue walk + if len(n.path) >= len(path) || path[len(n.path)] == '/' { + continue walk + } } else { // Wildcard conflict pathSeg := path