Update go/internal/handler/handler.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent
fa9d54aab5
commit
ffac812273
@@ -386,10 +386,16 @@ func (h *Handler) UpdateAvatar(w http.ResponseWriter, r *http.Request) {
|
|||||||
ContentType: r.Header.Get("Content-Type"),
|
ContentType: r.Header.Get("Content-Type"),
|
||||||
}, r.Body)
|
}, r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
var maxErr *http.MaxBytesError
|
||||||
|
if errors.As(err, &maxErr) {
|
||||||
|
http.Error(w, "avatar file too large", http.StatusRequestEntityTooLarge)
|
||||||
|
return
|
||||||
|
}
|
||||||
flog.Error("failed to upload avatar with depo", "error", err, "humanId", humanId)
|
flog.Error("failed to upload avatar with depo", "error", err, "humanId", humanId)
|
||||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = h.humanSvc.UpdateAvatar(r.Context(), humanId, object.ID)
|
err = h.humanSvc.UpdateAvatar(r.Context(), humanId, object.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user