From f52002f80d2db69e6be28036ac655e3e551f828d Mon Sep 17 00:00:00 2001 From: David Christofas Date: Fri, 22 Oct 2021 11:27:30 +0200 Subject: [PATCH] fix update storage spaces for admins (#2195) This is a quick fix until we have a better permission system. Admins can't list other spaces yet so we just return the space from the request. --- changelog/unreleased/update-storage-spaces.md | 1 + pkg/storage/utils/decomposedfs/spaces.go | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/changelog/unreleased/update-storage-spaces.md b/changelog/unreleased/update-storage-spaces.md index 2ae662963a1..c7b2fc5e15b 100644 --- a/changelog/unreleased/update-storage-spaces.md +++ b/changelog/unreleased/update-storage-spaces.md @@ -3,3 +3,4 @@ Enhancement: Implement the UpdateStorageSpace method Added the UpdateStorageSpace method to the decomposedfs. https://github.com/cs3org/reva/pull/2162 +https://github.com/cs3org/reva/pull/2195 diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index f95c5474c91..276d0162d59 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -254,7 +254,7 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up } if len(matches) != 1 { - return nil, errors.New("multiple spaces found") + return nil, fmt.Errorf("update space failed: found %d matching spaces", len(matches)) } target, err := os.Readlink(matches[0]) @@ -279,15 +279,9 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up } } - spaceType := filepath.Base(filepath.Dir(matches[0])) - updated, err := fs.storageSpaceFromNode(ctx, node, matches[0], spaceType) - if err != nil { - return nil, err - } - return &provider.UpdateStorageSpaceResponse{ Status: &v1beta11.Status{Code: v1beta11.Code_CODE_OK}, - StorageSpace: updated, + StorageSpace: space, }, nil }