From 2c5b3c72e8ebdf94ac764267fa78e4a0c5e93dc6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 4 Jun 2020 20:06:24 +0200 Subject: [PATCH] Fix bug with globally disabling mirror (#11760) Ensure we return after `ctx.Error(...)` --- routers/api/v1/misc/settings.go | 4 +++- routers/api/v1/repo/migrate.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/routers/api/v1/misc/settings.go b/routers/api/v1/misc/settings.go index 11c7eef726..e9493050ca 100644 --- a/routers/api/v1/misc/settings.go +++ b/routers/api/v1/misc/settings.go @@ -5,6 +5,8 @@ package misc import ( + "net/http" + "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/setting" ) @@ -19,5 +21,5 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/StringSlice" - ctx.JSON(200, setting.UI.Reactions) + ctx.JSON(http.StatusOK, setting.UI.Reactions) } diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go index 43b5a7db30..fa4b7366e8 100644 --- a/routers/api/v1/repo/migrate.go +++ b/routers/api/v1/repo/migrate.go @@ -115,6 +115,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { if form.Mirror && setting.Repository.DisableMirrors { ctx.Error(http.StatusForbidden, "MirrorsGlobalDisabled", fmt.Errorf("the site administrator has disabled mirrors")) + return } var opts = migrations.MigrateOptions{