Skip to content

Commit 36dfe54

Browse files
authored
Fix mirror address setting not working (#20850)
This patch fixes the issue that the mirror address field is ignored from the repo setting form.
1 parent 943753f commit 36dfe54

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

routers/web/repo/setting.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,17 @@ func SettingsPost(ctx *context.Context) {
228228
form.MirrorPassword, _ = u.User.Password()
229229
}
230230

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

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

0 commit comments

Comments
 (0)