From a4729060bedd45481726861c491d5061e90ffefa Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 3 Dec 2019 17:31:53 +0100 Subject: Escape mailbox names in URLs Closes: https://todo.sr.ht/~sircmpwn/koushin/14 --- template.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'template.go') diff --git a/template.go b/template.go index 5d0d28b..2581da0 100644 --- a/template.go +++ b/template.go @@ -3,6 +3,7 @@ package koushin import ( "html/template" "io" + "net/url" "github.com/labstack/echo/v4" ) @@ -20,6 +21,9 @@ func loadTemplates() (*tmpl, error) { "tuple": func(values ...interface{}) []interface{} { return values }, + "pathescape": func(s string) string { + return url.PathEscape(s) + }, }).ParseGlob("public/*.html") return &tmpl{t}, err } -- cgit v1.2.3-59-g8ed1b