From 08b3c1cb76309e8b23d42d34234b16369f164990 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 --- internal/grpc/services/gateway/storageprovider.go | 2 +- .../services/sharesstorageprovider/sharesstorageprovider.go | 2 +- internal/http/services/owncloud/ocdav/move.go | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index 5347f4bacd7..6c1ac742453 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 1a6b95bf6c0..7904acc5083 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 02f0e32b1f1..fbd51ee72fa 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