diff --git a/internal/fs/list.go b/internal/fs/list.go index 751b61f9..6e257cea 100644 --- a/internal/fs/list.go +++ b/internal/fs/list.go @@ -12,8 +12,8 @@ import ( // List files func list(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error) { - meta := ctx.Value("meta").(*model.Meta) - user := ctx.Value("user").(*model.User) + meta, _ := ctx.Value("meta").(*model.Meta) + user, _ := ctx.Value("user").(*model.User) virtualFiles := op.GetStorageVirtualFilesByPath(path) storage, actualPath, err := op.GetStorageAndActualPath(path) if err != nil && len(virtualFiles) == 0 { @@ -45,7 +45,7 @@ func list(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error) func whetherHide(user *model.User, meta *model.Meta, path string) bool { // if is admin, don't hide - if user.CanSeeHides() { + if user == nil || user.CanSeeHides() { return false } // if meta is nil, don't hide