1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-15 01:34:53 +02:00

Fix #1526 trailing slash to any route (#1563)

* refs #1526: Add tests for trailing slash requests with nested any routes

* refs #1526: Handle specual router case with trailing slash for non-root any route

* refs #1526: Fix accidential lookup for any route without trailing slash in request
This commit is contained in:
Roland Lammel
2020-05-06 23:01:28 +02:00
committed by GitHub
parent c08f30359b
commit 43e32ba83d
2 changed files with 76 additions and 1 deletions

View File

@ -355,6 +355,10 @@ func (r *Router) Find(method, path string, c Context) {
// Attempt to go back up the tree on no matching prefix or no remaining search
if l != pl || search == "" {
// Handle special case of trailing slash route with existing any route (see #1526)
if path[len(path)-1] == '/' && cn.findChildByKind(akind) != nil {
goto Any
}
if nn == nil { // Issue #1348
return // Not found
}