From a864348fbf198552ac3d0fc9e0772c3784f4876b Mon Sep 17 00:00:00 2001 From: David Christofas Date: Tue, 12 Oct 2021 10:57:46 +0200 Subject: [PATCH] augment the id of newly created spaces --- changelog/unreleased/augment-spaces-id.md | 5 +++++ .../grpc/services/storageprovider/storageprovider.go | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/augment-spaces-id.md diff --git a/changelog/unreleased/augment-spaces-id.md b/changelog/unreleased/augment-spaces-id.md new file mode 100644 index 00000000000..bcdad476b53 --- /dev/null +++ b/changelog/unreleased/augment-spaces-id.md @@ -0,0 +1,5 @@ +Enhancement: Augment the Id of new spaces + +Newly created spaces were missing the Root reference and the storage id in the space id. + +https://github.com/cs3org/reva/issues/2158 diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index c6e6d7f0606..0560c2278d9 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -433,7 +433,14 @@ func (s *service) CreateHome(ctx context.Context, req *provider.CreateHomeReques // CreateStorageSpace creates a storage space func (s *service) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error) { - return s.storage.CreateStorageSpace(ctx, req) + resp, err := s.storage.CreateStorageSpace(ctx, req) + if err != nil { + return nil, err + } + + resp.StorageSpace.Root = &provider.ResourceId{StorageId: s.mountID, OpaqueId: resp.StorageSpace.Id.OpaqueId} + resp.StorageSpace.Id = &provider.StorageSpaceId{OpaqueId: s.mountID + "!" + resp.StorageSpace.Id.OpaqueId} + return resp, nil } func hasNodeID(s *provider.StorageSpace) bool {