From e060ae88e58eab595736866e1e5c1f7eeee0a5d8 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 22 Aug 2024 00:10:50 +0800 Subject: [PATCH] Don't return 500 if mirror url contains special chars (#31859) (#31895) Backport #31859 --- routers/web/repo/setting/setting.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index 1e0349cdee..a7fd9a3de4 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -248,7 +248,8 @@ func SettingsPost(ctx *context.Context) { remoteAddress, err := util.SanitizeURL(form.MirrorAddress) if err != nil { - ctx.ServerError("SanitizeURL", err) + ctx.Data["Err_MirrorAddress"] = true + handleSettingRemoteAddrError(ctx, err, form) return } pullMirror.RemoteAddress = remoteAddress @@ -409,7 +410,8 @@ func SettingsPost(ctx *context.Context) { remoteAddress, err := util.SanitizeURL(form.PushMirrorAddress) if err != nil { - ctx.ServerError("SanitizeURL", err) + ctx.Data["Err_PushMirrorAddress"] = true + handleSettingRemoteAddrError(ctx, err, form) return }