From: Joe Mooring Date: Mon, 19 Dec 2022 08:58:56 +0000 (-0800) Subject: helpers: Allow at signs in UnicodeSanitize (note) X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2d217cba5108d30835a5cf10869cfbd0a70d22f7;p=brevno-suite%2Fhugo helpers: Allow at signs in UnicodeSanitize (note) Closes #10548 --- diff --git a/helpers/path.go b/helpers/path.go index ad2ff7658..b3f69ff90 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -102,7 +102,7 @@ func (p *PathSpec) UnicodeSanitize(s string) string { ) for i, r := range source { - isAllowed := r == '.' || r == '/' || r == '\\' || r == '_' || r == '#' || r == '+' || r == '~' || r == '-' + isAllowed := r == '.' || r == '/' || r == '\\' || r == '_' || r == '#' || r == '+' || r == '~' || r == '-' || r == '@' isAllowed = isAllowed || unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) isAllowed = isAllowed || (r == '%' && i+2 < len(source) && ishex(source[i+1]) && ishex(source[i+2])) diff --git a/helpers/path_test.go b/helpers/path_test.go index 3d0617f54..b8739f37a 100644 --- a/helpers/path_test.go +++ b/helpers/path_test.go @@ -57,6 +57,7 @@ func TestMakePath(t *testing.T) { {"this+is+a+test", "this+is+a+test", false}, // Issue #1290 {"~foo", "~foo", false}, // Issue #2177 {"foo--bar", "foo--bar", true}, // Issue #7288 + {"foo@bar", "foo@bar", true}, // Issue #10548 } for _, test := range tests {