Skip to content

Commit 6779c35

Browse files
zeripathBLumialunny
authored
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 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent c1889f5 commit 6779c35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

routers/web/repo/setting.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,17 @@ func SettingsPost(ctx *context.Context) {
227227
form.MirrorPassword, _ = u.User.Password()
228228
}
229229

230-
err = migrations.IsMigrateURLAllowed(u.String(), ctx.Doer)
230+
address, err := forms.ParseRemoteAddr(form.MirrorAddress, form.MirrorUsername, form.MirrorPassword)
231+
if err == nil {
232+
err = migrations.IsMigrateURLAllowed(address, ctx.Doer)
233+
}
231234
if err != nil {
232235
ctx.Data["Err_MirrorAddress"] = true
233236
handleSettingRemoteAddrError(ctx, err, form)
234237
return
235238
}
236239

237-
if err := mirror_service.UpdateAddress(ctx, ctx.Repo.Mirror, u.String()); err != nil {
240+
if err := mirror_service.UpdateAddress(ctx, ctx.Repo.Mirror, address); err != nil {
238241
ctx.ServerError("UpdateAddress", err)
239242
return
240243
}

0 commit comments

Comments
 (0)