Merge pull request #6469 from 2403905/issue-6414

Handle the bad request status for the CreateStorageSpace function
This commit is contained in:
Roman Perekhod authored and GitHub committed 2023-06-14 16:47:11 +03:00
commit 4f9a82ee99
2 files changed
+12

No files matched your search

@@ -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
View File
@@ -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