From dcdd8e352a11b52a4c9c36cdcd81718c485a831a Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Tue, 2 Jan 2024 11:46:33 +0100 Subject: [PATCH] fix: fix more status codes and error messages --- changelog/unreleased/fix-statuscode-move-denied.md | 1 + internal/grpc/services/gateway/storageprovider.go | 2 +- .../services/sharesstorageprovider/sharesstorageprovider.go | 2 +- internal/http/services/owncloud/ocdav/move.go | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/changelog/unreleased/fix-statuscode-move-denied.md b/changelog/unreleased/fix-statuscode-move-denied.md index dee8134ed9..692db6cba9 100644 --- a/changelog/unreleased/fix-statuscode-move-denied.md +++ b/changelog/unreleased/fix-statuscode-move-denied.md @@ -2,4 +2,5 @@ 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 5347f4bacd..6c1ac74245 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, "gateway does not support cross storage move, use copy and delete"), + Status: status.NewPermissionDenied(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 1a6b95bf6c..7904acc508 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -666,7 +666,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, "sharesstorageprovider: can not move between shares"), + Status: status.NewPermissionDenied(ctx, nil, "cross storage moves are not permitted, use copy and delete"), }, nil } diff --git a/internal/http/services/owncloud/ocdav/move.go b/internal/http/services/owncloud/ocdav/move.go index 02f0e32b1f..fbd51ee72f 100644 --- a/internal/http/services/owncloud/ocdav/move.go +++ b/internal/http/services/owncloud/ocdav/move.go @@ -283,8 +283,6 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req status = http.StatusPreconditionFailed case rpc.Code_CODE_PERMISSION_DENIED: status = http.StatusForbidden - // create oc10 compatible error message - m = "Destination directory is not writable" case rpc.Code_CODE_UNIMPLEMENTED: // We translate this into a Bad Gateway error as per https://www.rfc-editor.org/rfc/rfc4918#section-9.9.4 // > 502 (Bad Gateway) - This may occur when the destination is on another