Fix mirror address setting not working (#20850) (#20904)

Backport #20850

This patch fixes the issue that the mirror address field is ignored from the repo setting form.

Co-authored-by: Gary Wang <wzc782970009@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
tokarchuk/v1.17
zeripath 2 years ago committed by GitHub
parent c1889f5b01
commit 6779c351b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      routers/web/repo/setting.go

@ -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
}

Loading…
Cancel
Save