helpers: Allow at signs in UnicodeSanitize (note)

Closes #10548
This commit is contained in:
Joe Mooring 2022-12-19 00:58:56 -08:00 committed by GitHub
parent 17055d1fa7
commit 2d217cba51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View 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]))

View 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 {