Skip to content

Commit

Permalink
Merge pull request #4443 from micbar/fix-status-code
Browse files Browse the repository at this point in the history
fix: fix more status codes and error messages
  • Loading branch information
micbar authored Jan 2, 2024
2 parents 8e51f9a + dcdd8e3 commit e8443f2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/fix-statuscode-move-denied.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions internal/http/services/owncloud/ocdav/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e8443f2

Please sign in to comment.