helpers: Allow tilde in URLs - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit bc06135c96aa4db6fe36a4fc4f19a18fa1cb8935
DIR parent 45e3ed517a17648d54e8ce33618a8f251cfec603
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sat, 7 Jan 2017 19:29:20 +0100
helpers: Allow tilde in URLs
See #2177
Diffstat:
M helpers/path.go | 2 +-
M helpers/path_test.go | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
---
DIR diff --git a/helpers/path.go b/helpers/path.go
@@ -124,7 +124,7 @@ func (p *PathSpec) UnicodeSanitize(s string) string {
for i, r := range source {
if r == '%' && i+2 < len(source) && ishex(source[i+1]) && ishex(source[i+2]) {
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)
}
}
DIR diff --git a/helpers/path_test.go b/helpers/path_test.go
@@ -58,6 +58,8 @@ func TestMakePath(t *testing.T) {
{"संस्कृत", "संस्कृत", false},
{"a%C3%B1ame", "a%C3%B1ame", false}, // Issue #1292
{"this+is+a+test", "this+is+a+test", false}, // Issue #1290
+ {"~foo", "~foo", false}, // Issue #2177
+
}
for _, test := range tests {