fix: error reporting for archive endpoint

Returning 500 when copying to read-only destination.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek
2021-11-28 19:02:15 +01:00
parent 7324d94648
commit cbda62d1be
2 changed files with 16 additions and 2 deletions

View File

@ -133,8 +133,10 @@ func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder,
return
}
w.WriteHeader(http.StatusOK)
if err := copyFunc(); err != nil {
logrus.Error(err.Error())
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)
return
}
w.WriteHeader(http.StatusOK)
}