summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Mooring <joe.mooring@veriphor.com>2022-12-19 00:58:56 -0800
committerGitHub <noreply@github.com>2022-12-19 09:58:56 +0100
commit2d217cba5108d30835a5cf10869cfbd0a70d22f7 (patch)
treec42ab59431c2150725f3d1648467b25c6ecb092d
parent17055d1fa76ca23a408a2e6d4d67cc8023f4d2ed (diff)
helpers: Allow at signs in UnicodeSanitize (note)
Closes #10548
-rw-r--r--helpers/path.go2
-rw-r--r--helpers/path_test.go1
2 files changed, 2 insertions, 1 deletions
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 {