hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 55a4f6e48e381fffe33eba71ff6a08c593b1c2c7
parent ef9b915680e21d5ab5fceb7c7957fd0b626942a7
Author: Cathal Garvey <cathalgarvey@cathalgarvey.me>
Date:   Thu, 14 Jul 2016 14:53:33 +0100

Do not double-escape in querify

Test case modified and expanded for querify to reflect original bug and changes.

Fixes #2279
Diffstat:
Mtpl/template_funcs.go | 2+-
Mtpl/template_funcs_test.go | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git 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
@@ -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/