diff options
author | Cathal Garvey <cathalgarvey@cathalgarvey.me> | 2016-07-14 16:53:33 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-07-14 16:53:33 +0300 |
commit | 55a4f6e48e381fffe33eba71ff6a08c593b1c2c7 (patch) | |
tree | 1b308e89c4882578d78a39ff8f9ad15ddc2980cc /tpl | |
parent | ef9b915680e21d5ab5fceb7c7957fd0b626942a7 (diff) |
Do not double-escape in querify
Test case modified and expanded for querify to reflect original bug and changes.
Fixes #2279
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template_funcs.go | 2 | ||||
-rw-r--r-- | tpl/template_funcs_test.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go index b8896a9cd..c12218468 100644 --- a/tpl/template_funcs.go +++ b/tpl/template_funcs.go @@ -1769,7 +1769,7 @@ func querify(params ...interface{}) (string, error) { } for name, value := range vals { - qs.Add(name, url.QueryEscape(fmt.Sprintf("%v", value))) + qs.Add(name, fmt.Sprintf("%v", value)) } return qs.Encode(), nil diff --git a/tpl/template_funcs_test.go b/tpl/template_funcs_test.go index 1dcae066c..e6c3a78f1 100644 --- a/tpl/template_funcs_test.go +++ b/tpl/template_funcs_test.go @@ -103,7 +103,7 @@ modBool: {{modBool 15 3}} mul: {{mul 2 3}} plainify: {{ plainify "Hello <strong>world</strong>, gophers!" }} pluralize: {{ "cat" | pluralize }} -querify: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces") | safeHTML }} +querify: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }} readDir: {{ range (readDir ".") }}{{ .Name }}{{ end }} readFile: {{ readFile "README.txt" }} relURL 1: {{ "http://gohugo.io/" | relURL }} @@ -155,7 +155,7 @@ modBool: true mul: 6 plainify: Hello world, gophers! pluralize: cats -querify: bar=2&baz=with%2Bspaces&foo=1 +querify: bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose readDir: README.txt readFile: Hugo Rocks! relURL 1: http://gohugo.io/ |