bug in order

This commit is contained in:
Arjun Patel
2026-06-11 15:20:11 -07:00
parent 6bf2c9983a
commit 6f8349c62f
+12 -6
View File
@@ -342,18 +342,17 @@ func (h *Handler) DeleteAvatar(w http.ResponseWriter, r *http.Request) {
return
}
err := h.humanSvc.DeleteAvatar(r.Context(), humanId)
human, err := h.humanSvc.GetByID(r.Context(), humanId)
if err != nil {
flog.Error("failed to delete avatar from human", "error", err)
flog.Error("failed to get human by id", "error", err, "humanId", humanId)
http.Error(w, "internal server error", http.StatusInternalServerError)
return
}
// best-effort, gracefully continue
human, err := h.humanSvc.GetByID(r.Context(), humanId)
err := h.humanSvc.DeleteAvatar(r.Context(), humanId)
if err != nil {
flog.Error("failed to get human by id", "error", err, "humanId", humanId)
w.WriteHeader(http.StatusNoContent)
flog.Error("failed to delete avatar from human", "error", err)
http.Error(w, "internal server error", http.StatusInternalServerError)
return
}
@@ -401,6 +400,13 @@ func (h *Handler) UpdateAvatar(w http.ResponseWriter, r *http.Request) {
if err != nil {
flog.Error("failed to update human avatar", "error", err, "humanId", humanId)
http.Error(w, "internal server error", http.StatusInternalServerError)
// best effort
err = h.depotSvc.Delete(r.Context(), object.ID)
if err != nil {
flog.Error("best-effort delete of object failed", "error", err)
}
return
}