]> source.dussan.org Git - gitea.git/commitdiff
Add missed return after `ctx.ServerError` (#31130) (#31133)
authorGiteabot <teabot@gitea.io>
Tue, 28 May 2024 10:47:11 +0000 (18:47 +0800)
committerGitHub <noreply@github.com>
Tue, 28 May 2024 10:47:11 +0000 (12:47 +0200)
Backport #31130 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
routers/api/v1/repo/mirror.go
routers/web/admin/repos.go
routers/web/auth/auth.go
routers/web/org/projects.go
routers/web/repo/editor.go

index 2a896de4fe0e42ee1b884400530e88018481fd03..eddd449206a75d01fed40e8eb8253a5629bd428b 100644 (file)
@@ -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
index 0815879bb3edd563d9a93c4d6087a82a035b38d2..e7c27145dce9d0d171282c002edf3a42e10447e1 100644 (file)
@@ -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)
index 4083d64226cfa0d89dd4a76b691c84838f4b4932..842020791f51953307212b412e29b34dce94b2ee 100644 (file)
@@ -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)
index 50effbe9633f38a1b7a8b08bb0eaa9511708b69d..8a01fbee3ea6f2b49c2bbe1cef473a219909a811 100644 (file)
@@ -571,6 +571,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))
index 474d7503e4c7abfb6ecbc39d9316cb5b8f2ad30e..4ff86b5a6647bf2d8cd756a8ebe98c44bd31cead 100644 (file)
@@ -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))