From 02af5a26695d4131133cd02a8f041bde82545a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 4 Sep 2024 15:44:50 +0200 Subject: [PATCH] fix sharejail stat id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/fix-sharejail-stat-id.md | 6 ++++++ .../sharesstorageprovider.go | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 changelog/unreleased/fix-sharejail-stat-id.md diff --git a/changelog/unreleased/fix-sharejail-stat-id.md b/changelog/unreleased/fix-sharejail-stat-id.md new file mode 100644 index 0000000000..3d065395a4 --- /dev/null +++ b/changelog/unreleased/fix-sharejail-stat-id.md @@ -0,0 +1,6 @@ +Bugfix: Fix sharejail stat id + +Stating a share jail mountpoint now returns the same resourceid as in the directory listing of the share jail root. + +https://github.com/cs3org/reva/pull/4835 +https://github.com/owncloud/ocis/issues/9933 diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index 61efbacefa..92f6d74532 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -789,21 +789,26 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide return nil, err } - // TODO return reference? - return gatewayClient.Stat(ctx, &provider.StatRequest{ + statRes, err := gatewayClient.Stat(ctx, &provider.StatRequest{ Opaque: req.Opaque, Ref: buildReferenceInShare(req.Ref, receivedShare), ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, }) + if err != nil { + return nil, err + } - // FIXME when stating a share jail child we need to rewrite the id and use the share + // 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 - // but that might be problematic for eg. wopi because it needs the correct id? ... - // ... but that should stat the grant anyway - - // FIXME when navigating via /dav/spaces/a0ca6a90-a365-4782-871e-d44447bbc668 the web ui seems - // to continue navigating based on the id of resources, causing the path to change. Is that related to WOPI? + if statRes.GetStatus().GetCode() == rpc.Code_CODE_OK && receivedShare.MountPoint.Path == strings.TrimPrefix(req.Ref.Path, "./") && statRes.Info != nil { + statRes.Info.Id = &provider.ResourceId{ + StorageId: utils.ShareStorageProviderID, + SpaceId: utils.ShareStorageSpaceID, + OpaqueId: receivedShare.GetShare().GetId().GetOpaqueId(), + } + } + return statRes, nil } func (s *service) ListContainerStream(req *provider.ListContainerStreamRequest, ss provider.ProviderAPI_ListContainerStreamServer) error {