From f779bd697b38df7b0d2182852d116014a0f10b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 2 Oct 2024 17:04:54 +0200 Subject: [PATCH] fix share jail mountpoint parent id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .../unreleased/fix-sharejail-mountpoint-parentid.md | 6 ++++++ .../sharesstorageprovider/sharesstorageprovider.go | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/fix-sharejail-mountpoint-parentid.md diff --git a/changelog/unreleased/fix-sharejail-mountpoint-parentid.md b/changelog/unreleased/fix-sharejail-mountpoint-parentid.md new file mode 100644 index 0000000000..9c8833be72 --- /dev/null +++ b/changelog/unreleased/fix-sharejail-mountpoint-parentid.md @@ -0,0 +1,6 @@ +Bugfix: Fix share jail mountpoint parent id + +Stating a share jail mountpoint now returns the share jail root as the parent id. + +https://github.com/cs3org/reva/pull/4876 +https://github.com/owncloud/ocis/issues/9933 diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index 92f6d74532..86eae86859 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -798,14 +798,20 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide return nil, err } - // when stating a share jail mountpoint we need to rewrite the id and use the share - // jail space id as the mountpoint has a different id than the grant + // when stating a share jail mountpoint we need to rewrite the ids if statRes.GetStatus().GetCode() == rpc.Code_CODE_OK && receivedShare.MountPoint.Path == strings.TrimPrefix(req.Ref.Path, "./") && statRes.Info != nil { + // overwrite id with the share jail mountpoint id statRes.Info.Id = &provider.ResourceId{ StorageId: utils.ShareStorageProviderID, SpaceId: utils.ShareStorageSpaceID, OpaqueId: receivedShare.GetShare().GetId().GetOpaqueId(), } + // overwrite parent id with the share jail root + statRes.Info.ParentId = &provider.ResourceId{ + StorageId: utils.ShareStorageProviderID, + SpaceId: utils.ShareStorageSpaceID, + OpaqueId: utils.ShareStorageSpaceID, + } } return statRes, nil