Merge pull request #6469 from 2403905/issue-6414

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

View File

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

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