Skip to content

Commit 28d5420

Browse files
committed
fix
1 parent fb42972 commit 28d5420

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/templates/mailer.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ func Mailer(ctx context.Context) (*texttmpl.Template, *template.Template) {
6464
bodyTemplates := template.New("")
6565

6666
subjectTemplates.Funcs(mailSubjectTextFuncMap())
67-
bodyTemplates.Funcs(NewFuncMap())
67+
// To do the best to avoid serious breaking, add some functions back for body templates.
68+
// Keep in mind that some behaviors have changed, for worse case, double-escaping.
69+
// Custom template users should migrate to the new template system ASAP.
70+
bodyTemplateFuncMap := NewFuncMap()
71+
bodyTemplateFuncMap["Safe"] = SafeHTML
72+
bodyTemplateFuncMap["Escape"] = HTMLEscape
73+
bodyTemplateFuncMap["Str2html"] = SanitizeHTML
74+
bodyTemplates.Funcs(bodyTemplateFuncMap)
6875

6976
assetFS := AssetFS()
7077
refreshTemplates := func(firstRun bool) {

0 commit comments

Comments
 (0)