From ad55526e4693e13bfde0097937db189f1b1a7688 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 26 Jan 2024 09:22:44 +0100 Subject: [PATCH 1/2] fix: revert the status code denied moves --- changelog/unreleased/fix-statuscode-move-denied.md | 6 ------ internal/grpc/services/gateway/storageprovider.go | 2 +- .../services/sharesstorageprovider/sharesstorageprovider.go | 2 +- .../sharesstorageprovider/sharesstorageprovider_test.go | 4 ++-- 4 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 changelog/unreleased/fix-statuscode-move-denied.md diff --git a/changelog/unreleased/fix-statuscode-move-denied.md b/changelog/unreleased/fix-statuscode-move-denied.md deleted file mode 100644 index 692db6cba9..0000000000 --- a/changelog/unreleased/fix-statuscode-move-denied.md +++ /dev/null @@ -1,6 +0,0 @@ -Bugfix: Fixed wrong status code when moving a file to a denied path - -We fixed a bug when the status code 502 was returned when moving a file to a denied path. Status code 403 (forbidden) is now returned to be compatible with oc10. - -https://github.com/cs3org/reva/pull/4443 -https://github.com/cs3org/reva/pull/4439 diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index 6c1ac74245..e184716fc7 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -709,7 +709,7 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo if sourceProviderInfo.Address != destProviderInfo.Address { return &provider.MoveResponse{ - Status: status.NewPermissionDenied(ctx, nil, "cross storage moves are not permitted, use copy and delete"), + Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not permitted, use copy and delete"), }, nil } diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index 1d678d06bc..cf2bb72f8c 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -667,7 +667,7 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide if dstReceivedShare.Share.Id.OpaqueId != srcReceivedShare.Share.Id.OpaqueId { return &provider.MoveResponse{ - Status: status.NewPermissionDenied(ctx, nil, "cross storage moves are not permitted, use copy and delete"), + Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not permitted, use copy and delete"), }, nil } diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go index efc3f95c8f..eac7ac8035 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go @@ -808,7 +808,7 @@ var _ = Describe("Sharesstorageprovider", func() { gatewayClient.AssertNotCalled(GinkgoT(), "Move", mock.Anything, mock.Anything) Expect(err).ToNot(HaveOccurred()) Expect(res).ToNot(BeNil()) - Expect(res.Status.Code).To(Equal(rpc.Code_CODE_PERMISSION_DENIED)) + Expect(res.Status.Code).To(Equal(rpc.Code_CODE_UNIMPLEMENTED)) }) It("refuses to move a file between shares resolving to the same space", func() { @@ -826,7 +826,7 @@ var _ = Describe("Sharesstorageprovider", func() { gatewayClient.AssertNotCalled(GinkgoT(), "Move", mock.Anything, mock.Anything) Expect(err).ToNot(HaveOccurred()) Expect(res).ToNot(BeNil()) - Expect(res.Status.Code).To(Equal(rpc.Code_CODE_PERMISSION_DENIED)) + Expect(res.Status.Code).To(Equal(rpc.Code_CODE_UNIMPLEMENTED)) }) It("moves a file", func() { From fb514b7da99b19caa206122f82593daf139c7006 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 26 Jan 2024 11:53:38 +0100 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörn Friedrich Dreyer --- internal/grpc/services/gateway/storageprovider.go | 2 +- .../services/sharesstorageprovider/sharesstorageprovider.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index e184716fc7..cf3a7387e3 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -709,7 +709,7 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo if sourceProviderInfo.Address != destProviderInfo.Address { return &provider.MoveResponse{ - Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not permitted, use copy and delete"), + Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not supported, use copy and delete"), }, nil } diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index cf2bb72f8c..da3624fd7a 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -667,7 +667,7 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide if dstReceivedShare.Share.Id.OpaqueId != srcReceivedShare.Share.Id.OpaqueId { return &provider.MoveResponse{ - Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not permitted, use copy and delete"), + Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not supported, use copy and delete"), }, nil }