diff options
author | Gary Wang <wzc782970009@gmail.com> | 2022-08-22 02:23:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 19:23:50 +0100 |
commit | 36dfe544f49b26a77f7ee87d30b5464f1df1a6a7 (patch) | |
tree | db469fd24352de51e1a7db18b618a85da2b3fc36 /routers | |
parent | 943753f560fab8bb01946618b16c694bc2032827 (diff) | |
download | gitea-36dfe544f49b26a77f7ee87d30b5464f1df1a6a7.tar.gz gitea-36dfe544f49b26a77f7ee87d30b5464f1df1a6a7.zip |
Fix mirror address setting not working (#20850)
This patch fixes the issue that the mirror address field is ignored from the repo setting form.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/setting.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index a59824cecd..2a04dc06a3 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -228,14 +228,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 } |