mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 15:19:36 +01:00
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>
This commit is contained in:
parent
c1889f5b01
commit
6779c351b1
1 changed files with 5 additions and 2 deletions
|
@ -227,14 +227,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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue