diff --git a/changelog/unreleased/fix-drive-response.md b/changelog/unreleased/fix-drive-response.md new file mode 100644 index 00000000000..67d28b6210c --- /dev/null +++ b/changelog/unreleased/fix-drive-response.md @@ -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 diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index 306da720f7b..f5832b27582 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -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