From 4d9956cf658d7a970654ae3baf23ad995e287525 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 2 Jan 2020 11:06:57 -0800 Subject: Make sure external URLs are not encoded incorrectly by Go template engine --- template/functions.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'template/functions.go') diff --git a/template/functions.go b/template/functions.go index 157935d..3b6423f 100644 --- a/template/functions.go +++ b/template/functions.go @@ -48,6 +48,9 @@ func (f *funcMap) Map() template.FuncMap { "route": func(name string, args ...interface{}) string { return route.Path(f.router, name, args...) }, + "safeURL": func(url string) template.URL { + return template.URL(url) + }, "noescape": func(str string) template.HTML { return template.HTML(str) }, -- cgit v1.2.3