Update tree.go

This commit is contained in:
田欧 2019-02-20 16:25:26 +08:00 committed by GitHub
parent 09956d42fa
commit 028cb5508f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
if len(n.path) >= len(path) || path[len(n.path)] == '/' {
continue walk
}
} else {
// Wildcard conflict
pathSeg := path