]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
helpers: Allow at signs in UnicodeSanitize (note)
authorJoe Mooring <joe.mooring@veriphor.com>
Mon, 19 Dec 2022 08:58:56 +0000 (00:58 -0800)
committerGitHub <noreply@github.com>
Mon, 19 Dec 2022 08:58:56 +0000 (09:58 +0100)
Closes #10548

helpers/path.go
helpers/path_test.go

index ad2ff765803ea3faa0e3cefef82e48428ba60121..b3f69ff90c64c25a8bac4809336be38bcd4e16ce 100644 (file)
@@ -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]))
 
index 3d0617f54f5db076aec8daee5e71df86959fbaea..b8739f37ad581d074124cb867819ab7f6bcba9cc 100644 (file)
@@ -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 {