Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tischda authored and tychoish committed Aug 13, 2017
1 parent 439ba81 commit 9fd6b1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion helpers/path.go
Expand Up @@ -96,7 +96,7 @@ func UnicodeSanitize(s string) string {
target := make([]rune, 0, len(source))

for _, r := range source {
if unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) || r == '.' || r == '/' || r == '\\' || r == '_' || r == '-' || r == '#' {
if unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) || r == '%' || r == '.' || r == '/' || r == '\\' || r == '_' || r == '-' || r == '#' {
target = append(target, r)
}
}
Expand Down
8 changes: 5 additions & 3 deletions helpers/path_test.go
Expand Up @@ -40,13 +40,14 @@ func TestMakePath(t *testing.T) {
}{
{" Foo bar ", "Foo-bar", true},
{"Foo.Bar/foo_Bar-Foo", "Foo.Bar/foo_Bar-Foo", true},
{"fOO,bar:foo%bAR", "fOObarfoobAR", true},
{"fOO,bar:foobAR", "fOObarfoobAR", true},
{"FOo/BaR.html", "FOo/BaR.html", true},
{"трям/трям", "трям/трям", true},
{"은행", "은행", true},
{"Банковский кассир", "Банковскии-кассир", true},
// Issue #1488
{"संस्कृत", "संस्कृत", false},
{"a%C3%B1ame", "a%C3%B1ame", false}, // Issue #1292
}

for _, test := range tests {
Expand All @@ -68,7 +69,7 @@ func TestMakePathSanitized(t *testing.T) {
}{
{" FOO bar ", "foo-bar"},
{"Foo.Bar/fOO_bAr-Foo", "foo.bar/foo_bar-foo"},
{"FOO,bar:Foo%Bar", "foobarfoobar"},
{"FOO,bar:FooBar", "foobarfoobar"},
{"foo/BAR.HTML", "foo/bar.html"},
{"трям/трям", "трям/трям"},
{"은행", "은행"},
Expand All @@ -93,7 +94,7 @@ func TestMakePathSanitizedDisablePathToLower(t *testing.T) {
}{
{" FOO bar ", "FOO-bar"},
{"Foo.Bar/fOO_bAr-Foo", "Foo.Bar/fOO_bAr-Foo"},
{"FOO,bar:Foo%Bar", "FOObarFooBar"},
{"FOO,bar:FooBar", "FOObarFooBar"},
{"foo/BAR.HTML", "foo/BAR.HTML"},
{"трям/трям", "трям/трям"},
{"은행", "은행"},
Expand Down Expand Up @@ -771,6 +772,7 @@ func TestGetTempDir(t *testing.T) {
{testDir + " Foo bar ", dir + testDir + " Foo bar " + FilePathSeparator},
{testDir + "Foo.Bar/foo_Bar-Foo", dir + testDir + "Foo.Bar/foo_Bar-Foo" + FilePathSeparator},
{testDir + "fOO,bar:foo%bAR", dir + testDir + "fOObarfoo%bAR" + FilePathSeparator},
{testDir + "fOO,bar:foobAR", dir + testDir + "fOObarfoobAR" + FilePathSeparator},
{testDir + "FOo/BaR.html", dir + testDir + "FOo/BaR.html" + FilePathSeparator},
{testDir + "трям/трям", dir + testDir + "трям/трям" + FilePathSeparator},
{testDir + "은행", dir + testDir + "은행" + FilePathSeparator},
Expand Down
2 changes: 1 addition & 1 deletion helpers/url_test.go
Expand Up @@ -28,7 +28,7 @@ func TestURLize(t *testing.T) {
}{
{" foo bar ", "foo-bar"},
{"foo.bar/foo_bar-foo", "foo.bar/foo_bar-foo"},
{"foo,bar:foo%bar", "foobarfoobar"},
{"foo,bar:foobar", "foobarfoobar"},
{"foo/bar.html", "foo/bar.html"},
{"трям/трям", "%D1%82%D1%80%D1%8F%D0%BC/%D1%82%D1%80%D1%8F%D0%BC"},
}
Expand Down

0 comments on commit 9fd6b1b

Please sign in to comment.