mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 02:52:14 -05:00
parent
45e3ed517a
commit
bc06135c96
2 changed files with 3 additions and 1 deletions
|
@ -124,7 +124,7 @@ func (p *PathSpec) UnicodeSanitize(s string) string {
|
||||||
for i, r := range source {
|
for i, r := range source {
|
||||||
if r == '%' && i+2 < len(source) && ishex(source[i+1]) && ishex(source[i+2]) {
|
if r == '%' && i+2 < len(source) && ishex(source[i+1]) && ishex(source[i+2]) {
|
||||||
target = append(target, r)
|
target = append(target, r)
|
||||||
} else if unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) || r == '.' || r == '/' || r == '\\' || r == '_' || r == '-' || r == '#' || r == '+' {
|
} else if unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) || r == '.' || r == '/' || r == '\\' || r == '_' || r == '-' || r == '#' || r == '+' || r == '~' {
|
||||||
target = append(target, r)
|
target = append(target, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ func TestMakePath(t *testing.T) {
|
||||||
{"संस्कृत", "संस्कृत", false},
|
{"संस्कृत", "संस्कृत", false},
|
||||||
{"a%C3%B1ame", "a%C3%B1ame", false}, // Issue #1292
|
{"a%C3%B1ame", "a%C3%B1ame", false}, // Issue #1292
|
||||||
{"this+is+a+test", "this+is+a+test", false}, // Issue #1290
|
{"this+is+a+test", "this+is+a+test", false}, // Issue #1290
|
||||||
|
{"~foo", "~foo", false}, // Issue #2177
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
Loading…
Reference in a new issue