From 55a4f6e48e381fffe33eba71ff6a08c593b1c2c7 Mon Sep 17 00:00:00 2001 From: Cathal Garvey Date: Thu, 14 Jul 2016 14:53:33 +0100 Subject: [PATCH] Do not double-escape in querify Test case modified and expanded for querify to reflect original bug and changes. Fixes #2279 --- tpl/template_funcs.go | 2 +- 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 world, 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/