Merge pull request '[v7.0/forgejo] Add multiple missed return after an error condition' (#3960) from earl-warren/forgejo:wip-v7.0-missed-return into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3960 Reviewed-by: Victoria <efertone@noreply.codeberg.org>
This commit is contained in:
commit
2f9be3e824
6 changed files with 8 additions and 0 deletions
|
@ -46,6 +46,7 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||||
err = user_service.UploadAvatar(ctx, ctx.Org.Organization.AsUser(), content)
|
err = user_service.UploadAvatar(ctx, ctx.Org.Organization.AsUser(), content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
@ -72,6 +73,7 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||||
err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser())
|
err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
|
|
@ -39,6 +39,7 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||||
err = user_service.UploadAvatar(ctx, ctx.Doer, content)
|
err = user_service.UploadAvatar(ctx, ctx.Doer, content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
@ -57,6 +58,7 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||||
err := user_service.DeleteAvatar(ctx, ctx.Doer)
|
err := user_service.DeleteAvatar(ctx, ctx.Doer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
|
|
@ -94,6 +94,7 @@ func UnadoptedRepos(ctx *context.Context) {
|
||||||
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx, q, &opts)
|
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx, q, &opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("ListUnadoptedRepositories", err)
|
ctx.ServerError("ListUnadoptedRepositories", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["Dirs"] = repoNames
|
ctx.Data["Dirs"] = repoNames
|
||||||
pager := context.NewPagination(count, opts.PageSize, opts.Page, 5)
|
pager := context.NewPagination(count, opts.PageSize, opts.Page, 5)
|
||||||
|
|
|
@ -841,6 +841,7 @@ func ActivateEmail(ctx *context.Context) {
|
||||||
if email := user_model.VerifyActiveEmailCode(ctx, code, emailStr); email != nil {
|
if email := user_model.VerifyActiveEmailCode(ctx, code, emailStr); email != nil {
|
||||||
if err := user_model.ActivateEmail(ctx, email); err != nil {
|
if err := user_model.ActivateEmail(ctx, email); err != nil {
|
||||||
ctx.ServerError("ActivateEmail", err)
|
ctx.ServerError("ActivateEmail", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Email activated: %s", email.Email)
|
log.Trace("Email activated: %s", email.Email)
|
||||||
|
|
|
@ -571,6 +571,7 @@ func MoveIssues(ctx *context.Context) {
|
||||||
form := &movedIssuesForm{}
|
form := &movedIssuesForm{}
|
||||||
if err = json.NewDecoder(ctx.Req.Body).Decode(&form); err != nil {
|
if err = json.NewDecoder(ctx.Req.Body).Decode(&form); err != nil {
|
||||||
ctx.ServerError("DecodeMovedIssuesForm", err)
|
ctx.ServerError("DecodeMovedIssuesForm", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issueIDs := make([]int64, 0, len(form.Issues))
|
issueIDs := make([]int64, 0, len(form.Issues))
|
||||||
|
|
|
@ -604,6 +604,7 @@ func DeleteFilePost(ctx *context.Context) {
|
||||||
} else {
|
} else {
|
||||||
ctx.ServerError("DeleteRepoFile", err)
|
ctx.ServerError("DeleteRepoFile", err)
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
|
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
|
||||||
|
|
Loading…
Reference in a new issue