aboutsummaryrefslogtreecommitdiffstats
path: root/template.go
diff options
context:
space:
mode:
authorLibravatarLibravatar Simon Ser <[email protected]> 2019-12-03 17:31:53 +0100
committerLibravatarLibravatar Simon Ser <[email protected]> 2019-12-03 17:31:53 +0100
commita4729060bedd45481726861c491d5061e90ffefa (patch)
treed9ee85915912c2186162e5ae737f89d3a5751549 /template.go
parent48d6d5d227a4d55d80f9f2a74c1242cafafab7ab (diff)
downloadalps-a4729060bedd45481726861c491d5061e90ffefa.tar.gz
alps-a4729060bedd45481726861c491d5061e90ffefa.tar.bz2
alps-a4729060bedd45481726861c491d5061e90ffefa.zip
Escape mailbox names in URLs
Closes: https://todo.sr.ht/~sircmpwn/koushin/14
Diffstat (limited to 'template.go')
-rw-r--r--template.go4
1 files changed, 4 insertions, 0 deletions
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
}