From 50fdae8bb8bdaebdcf64eff2e55f543bddfd5794 Mon Sep 17 00:00:00 2001 From: Lucio Chen Date: Thu, 21 May 2026 02:33:28 -0700 Subject: [PATCH] Fix html/template string escaping of catalog JSON using safeJS --- internal/server/templates.go | 3 +++ internal/server/templates/items.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/server/templates.go b/internal/server/templates.go index c67fadb..c2d6e03 100644 --- a/internal/server/templates.go +++ b/internal/server/templates.go @@ -22,6 +22,9 @@ var templates *template.Template var templateMap map[string]*template.Template var templateFuncs = template.FuncMap{ + "safeJS": func(s string) template.JS { + return template.JS(s) + }, "formatPrice": func(p any) string { switch v := p.(type) { case float64: diff --git a/internal/server/templates/items.html b/internal/server/templates/items.html index a40d02d..8665263 100644 --- a/internal/server/templates/items.html +++ b/internal/server/templates/items.html @@ -436,7 +436,7 @@