diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/router.go')
-rw-r--r-- | vendor/github.com/labstack/echo/v4/router.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/vendor/github.com/labstack/echo/v4/router.go b/vendor/github.com/labstack/echo/v4/router.go index 8d3a0180..70bf409f 100644 --- a/vendor/github.com/labstack/echo/v4/router.go +++ b/vendor/github.com/labstack/echo/v4/router.go @@ -20,8 +20,8 @@ type ( pnames []string methodHandler *methodHandler } - kind uint8 - children []*node + kind uint8 + children []*node methodHandler struct { connect HandlerFunc delete HandlerFunc @@ -336,10 +336,14 @@ func (r *Router) Find(method, path string, c Context) { } } + if l == pl { // Continue search search = search[l:] } else { + if nn == nil { // Issue #1348 + return // Not found + } cn = nn search = ns if nk == pkind { @@ -347,8 +351,6 @@ func (r *Router) Find(method, path string, c Context) { } else if nk == akind { goto Any } - // Not found - return } if search == "" { @@ -398,6 +400,9 @@ func (r *Router) Find(method, path string, c Context) { if nn != nil { cn = nn nn = cn.parent // Next (Issue #954) + if nn != nil { + nk = nn.kind + } search = ns if nk == pkind { goto Param @@ -405,8 +410,7 @@ func (r *Router) Find(method, path string, c Context) { goto Any } } - // Not found - return + return // Not found } pvalues[len(cn.pnames)-1] = search break |