1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

Fix bug with globally disabling mirror (#11760)

Ensure we return after `ctx.Error(...)`
This commit is contained in:
6543 2020-06-04 20:06:24 +02:00 committed by GitHub
parent 0cb22121f4
commit 2c5b3c72e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,8 @@
package misc package misc
import ( import (
"net/http"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
) )
@ -19,5 +21,5 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/StringSlice" // "$ref": "#/responses/StringSlice"
ctx.JSON(200, setting.UI.Reactions) ctx.JSON(http.StatusOK, setting.UI.Reactions)
} }

View File

@ -115,6 +115,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
if form.Mirror && setting.Repository.DisableMirrors { if form.Mirror && setting.Repository.DisableMirrors {
ctx.Error(http.StatusForbidden, "MirrorsGlobalDisabled", fmt.Errorf("the site administrator has disabled mirrors")) ctx.Error(http.StatusForbidden, "MirrorsGlobalDisabled", fmt.Errorf("the site administrator has disabled mirrors"))
return
} }
var opts = migrations.MigrateOptions{ var opts = migrations.MigrateOptions{