Fix html/template string escaping of catalog JSON using safeJS
This commit is contained in:
1 parent
92ebb0f65a
commit
50fdae8bb8
2 files changed
+4
-1
No files matched your search
@@ -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:
|
||||
|
||||
@@ -436,7 +436,7 @@
|
||||
|
||||
<script>
|
||||
// Parse catalog JSON data dynamically injected by handler
|
||||
const catalog = {{.CatalogJSON}};
|
||||
const catalog = {{safeJS .CatalogJSON}};
|
||||
|
||||
let currentStep = 1;
|
||||
let selectedCategory = null;
|
||||
|
||||
Reference in new issue
Block a user