This commit is contained in:
MichaelDeSteven 2022-02-05 09:30:38 +08:00 committed by GitHub
parent 580e7da6ee
commit 41d38fb68c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ func longestCommonPrefix(a, b string) int {
return i return i
} }
// addChild will add a child node, keeping wildcards at the end // addChild will add a child node, keeping wildcardChild at the end
func (n *node) addChild(child *node) { func (n *node) addChild(child *node) {
if n.wildChild && len(n.children) > 0 { if n.wildChild && len(n.children) > 0 {
wildcardChild := n.children[len(n.children)-1] wildcardChild := n.children[len(n.children)-1]
@ -296,7 +296,7 @@ func (n *node) insertChild(path string, fullPath string, handlers HandlersChain)
break break
} }
// The wildcard name must not contain ':' and '*' // The wildcard name must only contain one ':' or '*' character
if !valid { if !valid {
panic("only one wildcard per path segment is allowed, has: '" + panic("only one wildcard per path segment is allowed, has: '" +
wildcard + "' in path '" + fullPath + "'") wildcard + "' in path '" + fullPath + "'")