Skip to content

Commit

Permalink
Handle the bad request status for the CreateStorageSpace function
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 authored and fschade committed Jul 10, 2023
1 parent fc0c50e commit 1d1d5c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-drive-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Handle the bad request status

Handle the bad request status for the CreateStorageSpace function

https://github.com/owncloud/ocis/pull/6469
https://github.com/cs3org/reva/pull/3948
https://github.com/owncloud/ocis/issues/6414
5 changes: 5 additions & 0 deletions services/graph/pkg/service/v0/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
errorcode.NotAllowed.Render(w, r, http.StatusForbidden, "permission denied")
return
}
if resp.GetStatus().GetCode() == cs3rpc.Code_CODE_INVALID_ARGUMENT {
logger.Debug().Str("grpcmessage", resp.GetStatus().GetMessage()).Msg("could not create drive: bad request")
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, resp.GetStatus().GetMessage())
return
}
logger.Debug().Interface("grpcmessage", csr).Str("grpc", resp.GetStatus().GetMessage()).Msg("could not create drive: grpc error")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, resp.GetStatus().GetMessage())
return
Expand Down

0 comments on commit 1d1d5c0

Please sign in to comment.