From b6f15c7948ac3d09977350de83ec91d5789ea083 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 28 May 2024 17:31:59 +0800 Subject: [PATCH] Add missed return after `ctx.ServerError` (#31130) --- routers/api/v1/repo/mirror.go | 1 + routers/web/admin/repos.go | 1 + routers/web/auth/auth.go | 1 + routers/web/org/projects.go | 1 + routers/web/repo/editor.go | 1 + 5 files changed, 5 insertions(+) diff --git a/routers/api/v1/repo/mirror.go b/routers/api/v1/repo/mirror.go index 2a896de4f..eddd44920 100644 --- a/routers/api/v1/repo/mirror.go +++ b/routers/api/v1/repo/mirror.go @@ -383,6 +383,7 @@ func CreatePushMirror(ctx *context.APIContext, mirrorOption *api.CreatePushMirro if err = mirror_service.AddPushMirrorRemote(ctx, pushMirror, address); err != nil { if err := repo_model.DeletePushMirrors(ctx, repo_model.PushMirrorOptions{ID: pushMirror.ID, RepoID: pushMirror.RepoID}); err != nil { ctx.ServerError("DeletePushMirrors", err) + return } ctx.ServerError("AddPushMirrorRemote", err) return diff --git a/routers/web/admin/repos.go b/routers/web/admin/repos.go index 0815879bb..e7c27145d 100644 --- a/routers/web/admin/repos.go +++ b/routers/web/admin/repos.go @@ -95,6 +95,7 @@ func UnadoptedRepos(ctx *context.Context) { repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx, q, &opts) if err != nil { ctx.ServerError("ListUnadoptedRepositories", err) + return } ctx.Data["Dirs"] = repoNames pager := context.NewPagination(count, opts.PageSize, opts.Page, 5) diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index 4083d6422..842020791 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -831,6 +831,7 @@ func ActivateEmail(ctx *context.Context) { if email := user_model.VerifyActiveEmailCode(ctx, code, emailStr); email != nil { if err := user_model.ActivateEmail(ctx, email); err != nil { ctx.ServerError("ActivateEmail", err) + return } log.Trace("Email activated: %s", email.Email) diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go index 8fb8f2540..9ab3c21cb 100644 --- a/routers/web/org/projects.go +++ b/routers/web/org/projects.go @@ -569,6 +569,7 @@ func MoveIssues(ctx *context.Context) { form := &movedIssuesForm{} if err = json.NewDecoder(ctx.Req.Body).Decode(&form); err != nil { ctx.ServerError("DecodeMovedIssuesForm", err) + return } issueIDs := make([]int64, 0, len(form.Issues)) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 474d7503e..4ff86b5a6 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -562,6 +562,7 @@ func DeleteFilePost(ctx *context.Context) { } else { ctx.ServerError("DeleteRepoFile", err) } + return } ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))