feat(files): disallow normal users to access home dir

This commit is contained in:
hexxa 2021-08-13 17:22:35 +08:00 committed by Hexxa
parent 8eac11afda
commit 7752733fb9

View file

@ -96,7 +96,7 @@ func (h *FileHandlers) canAccess(userID, role, op, path string) bool {
// the file path must start with userID: <userID>/...
parts := strings.Split(path, "/")
if len(parts) < 1 {
if len(parts) < 2 { // the path must be longer than <userName>/files
return false
} else if parts[0] == userID {
return true