prevent purging of enabled spaces

This commit is contained in:
David Christofas
2022-01-20 17:26:10 +01:00
parent 5571223682
commit d70fe6ac13
3 changed files with 7 additions and 3 deletions
+6 -1
View File
@@ -779,7 +779,12 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) {
OpaqueId: root.StorageId,
},
})
if err != nil || dRes.Status.Code != cs3rpc.Code_CODE_OK {
switch {
case dRes.Status.Code == cs3rpc.Code_CODE_INVALID_ARGUMENT:
errorcode.GeneralException.Render(w, r, http.StatusBadRequest, dRes.Status.Message)
w.WriteHeader(http.StatusBadRequest)
return
case err != nil || dRes.Status.Code != cs3rpc.Code_CODE_OK:
g.logger.Error().Err(err).Msg("error deleting storage space")
w.WriteHeader(http.StatusInternalServerError)
return