Fix issue 4961 (#5025)

Signed-off-by: GuoHuiPeng <1205504832@qq.com>
This commit is contained in:
GuoHuiPeng 2022-07-21 00:33:11 +08:00 committed by GitHub
parent a451f398a3
commit c280209bf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,6 +284,8 @@ func (t *Tree) addseg(segments []string, route interface{}, wildcards []string,
// Match router to runObject & params
func (t *Tree) Match(pattern string, ctx *context.Context) (runObject interface{}) {
// fix issue 4961, deal with "./ ../ //"
pattern = path.Clean(pattern)
if len(pattern) == 0 || pattern[0] != '/' {
return nil
}