0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-24 00:03:11 -05:00

Fix mirror address setting not working (#20850)

This patch fixes the issue that the mirror address field is ignored from the repo setting form.
This commit is contained in:
Gary Wang 2022-08-22 02:23:50 +08:00 committed by GitHub
parent 943753f560
commit 36dfe544f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,14 +228,17 @@ func SettingsPost(ctx *context.Context) {
form.MirrorPassword, _ = u.User.Password() 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 { if err != nil {
ctx.Data["Err_MirrorAddress"] = true ctx.Data["Err_MirrorAddress"] = true
handleSettingRemoteAddrError(ctx, err, form) handleSettingRemoteAddrError(ctx, err, form)
return 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) ctx.ServerError("UpdateAddress", err)
return return
} }