From 12a095a1d654654b9d9e819fad4c0d8b77e45b25 Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Sun, 5 Mar 2023 15:29:53 +0800 Subject: [PATCH] fix: slice bounds out of range on `CanAccess` check --- server/common/check.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/common/check.go b/server/common/check.go index ce342118..787dd2f5 100644 --- a/server/common/check.go +++ b/server/common/check.go @@ -29,7 +29,7 @@ func CanAccess(user *model.User, meta *model.Meta, reqPath string, password stri IsApply(meta.Path, path.Dir(reqPath), meta.HSub) { // the meta should apply to the parent of current path for _, hide := range strings.Split(meta.Hide, "\n") { re := regexp.MustCompile(hide) - if re.MatchString(reqPath[len(meta.Path)+1:]) { + if re.MatchString(path.Base(reqPath)) { return false } }