Skip to content

Commit

Permalink
Fix mirror address setting not working (go-gitea#20850)
Browse files Browse the repository at this point in the history
Backport go-gitea#20850

This patch fixes the issue that the mirror address field is ignored from the repo setting form.
  • Loading branch information
BLumia authored and zeripath committed Aug 21, 2022
1 parent 17d3a47 commit 238bb70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions routers/web/repo/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,17 @@ func SettingsPost(ctx *context.Context) {
form.MirrorPassword, _ = u.User.Password()
}

err = migrations.IsMigrateURLAllowed(u.String(), ctx.Doer)
address, err := forms.ParseRemoteAddr(form.MirrorAddress, form.MirrorUsername, form.MirrorPassword)
if err == nil {
err = migrations.IsMigrateURLAllowed(address, ctx.Doer)
}
if err != nil {
ctx.Data["Err_MirrorAddress"] = true
handleSettingRemoteAddrError(ctx, err, form)
return
}

if err := mirror_service.UpdateAddress(ctx, ctx.Repo.Mirror, u.String()); err != nil {
if err := mirror_service.UpdateAddress(ctx, ctx.Repo.Mirror, address); err != nil {
ctx.ServerError("UpdateAddress", err)
return
}
Expand Down

0 comments on commit 238bb70

Please sign in to comment.