From 7bd9597803a26655c7bb3d18e0694d2e680c2b37 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Mon, 20 May 2024 10:54:53 +0800 Subject: [PATCH] Missed return on error part of: Fix bug on avatar (#31008) (#31019) Backport #31008 by @lunny Extract from #30995 Co-authored-by: Lunny Xiao Co-authored-by: silverwind (cherry picked from commit 8446caa813f676398411d3544cc05a42fd708cd1) --- routers/api/v1/org/avatar.go | 2 ++ routers/api/v1/user/avatar.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/routers/api/v1/org/avatar.go b/routers/api/v1/org/avatar.go index e34c68dfc9..f11eb6c1cd 100644 --- a/routers/api/v1/org/avatar.go +++ b/routers/api/v1/org/avatar.go @@ -46,6 +46,7 @@ func UpdateAvatar(ctx *context.APIContext) { err = user_service.UploadAvatar(ctx, ctx.Org.Organization.AsUser(), content) if err != nil { ctx.Error(http.StatusInternalServerError, "UploadAvatar", err) + return } ctx.Status(http.StatusNoContent) @@ -72,6 +73,7 @@ func DeleteAvatar(ctx *context.APIContext) { err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser()) if err != nil { ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) + return } ctx.Status(http.StatusNoContent) diff --git a/routers/api/v1/user/avatar.go b/routers/api/v1/user/avatar.go index f912296228..30ccb63587 100644 --- a/routers/api/v1/user/avatar.go +++ b/routers/api/v1/user/avatar.go @@ -39,6 +39,7 @@ func UpdateAvatar(ctx *context.APIContext) { err = user_service.UploadAvatar(ctx, ctx.Doer, content) if err != nil { ctx.Error(http.StatusInternalServerError, "UploadAvatar", err) + return } ctx.Status(http.StatusNoContent) @@ -57,6 +58,7 @@ func DeleteAvatar(ctx *context.APIContext) { err := user_service.DeleteAvatar(ctx, ctx.Doer) if err != nil { ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) + return } ctx.Status(http.StatusNoContent)