use text/template to avoid HTML escaping
Co-authored-by: Roy O'Young <roy2220@outlook.com> Closes #57
This commit is contained in:
10
tmpl_test.go
10
tmpl_test.go
@@ -16,9 +16,9 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"html/template"
|
||||
"os"
|
||||
"testing"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -170,6 +170,14 @@ func TestExecuteTemplate(t *testing.T) {
|
||||
"/*", " * ", "*/",
|
||||
"/*\n * HYS\n*/\n\n",
|
||||
},
|
||||
|
||||
// ensure we don't escape HTML characters by using the wrong template package
|
||||
{
|
||||
"{{.Holder}}",
|
||||
licenseData{Holder: "A&Z"},
|
||||
"", "", "",
|
||||
"A&Z\n\n",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user