Skip to content

Commit

Permalink
The DeleteStorageSpace method response code has been changed to 'not …
Browse files Browse the repository at this point in the history
…found' if no one spaces in a list or errtypes.IsNotFound
  • Loading branch information
2403905 committed May 4, 2023
1 parent 756a843 commit 69238ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-response-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix response code

he DeleteStorageSpace method response code has been changed

https://github.com/cs3org/reva/pull/3848
7 changes: 6 additions & 1 deletion internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,18 @@ func (s *service) DeleteStorageSpace(ctx context.Context, req *provider.DeleteSt
if err != nil || len(spaces) != 1 {
var st *rpc.Status
switch err.(type) {
case errtypes.IsNotFound, errtypes.PermissionDenied:
case errtypes.IsNotFound:
st = status.NewNotFound(ctx, "not found when deleting space")
case errtypes.PermissionDenied:
st = status.NewPermissionDenied(ctx, err, "permission denied")
case errtypes.BadRequest:
st = status.NewInvalid(ctx, err.Error())
default:
st = status.NewInternal(ctx, "error deleting space: "+req.Id.String())
}
if len(spaces) == 0 {
st = status.NewNotFound(ctx, "not found when deleting space")
}
return &provider.DeleteStorageSpaceResponse{
Status: st,
}, nil
Expand Down

0 comments on commit 69238ad

Please sign in to comment.