fix: slice bounds out of range on CanAccess check

This commit is contained in:
Andy Hsu 2023-03-05 15:29:53 +08:00
parent dc000f640a
commit 12a095a1d6

View File

@ -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
}
}