Skip to content

Commit e060ae8

Browse files
authored
Don't return 500 if mirror url contains special chars (#31859) (#31895)
Backport #31859
1 parent d9c65c9 commit e060ae8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

routers/web/repo/setting/setting.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ func SettingsPost(ctx *context.Context) {
248248

249249
remoteAddress, err := util.SanitizeURL(form.MirrorAddress)
250250
if err != nil {
251-
ctx.ServerError("SanitizeURL", err)
251+
ctx.Data["Err_MirrorAddress"] = true
252+
handleSettingRemoteAddrError(ctx, err, form)
252253
return
253254
}
254255
pullMirror.RemoteAddress = remoteAddress
@@ -409,7 +410,8 @@ func SettingsPost(ctx *context.Context) {
409410

410411
remoteAddress, err := util.SanitizeURL(form.PushMirrorAddress)
411412
if err != nil {
412-
ctx.ServerError("SanitizeURL", err)
413+
ctx.Data["Err_PushMirrorAddress"] = true
414+
handleSettingRemoteAddrError(ctx, err, form)
413415
return
414416
}
415417

0 commit comments

Comments
 (0)