Skip to content

Commit 982f48e

Browse files
committed
fix: {“message":"Error compiling template: error compiling message: template: content:2: unexpected \"\u003e\" in operand”} error in campaign preview.
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
1 parent 770bdb2 commit 982f48e

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ require (
2929
github.com/paulbellamy/ratecounter v0.2.0
3030
github.com/rhnvrm/simples3 v0.8.3
3131
github.com/spf13/pflag v1.0.5
32+
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
3233
github.com/yuin/goldmark v1.6.0
3334
github.com/zerodha/easyjson v1.0.0
3435
golang.org/x/mod v0.14.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
132132
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
133133
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
134134
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
135+
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4 h1:0sw0nJM544SpsihWx1bkXdYLQDlzRflMgFJQ4Yih9ts=
136+
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4/go.mod h1:+ccdNT0xMY1dtc5XBxumbYfOUhmduiGudqaDgD2rVRE=
135137
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
136138
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
137139
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=

models/models.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9+
"github.com/yosssi/gohtml"
910
"html/template"
1011
"net/textproto"
1112
"regexp"
@@ -569,6 +570,8 @@ func (c *Campaign) CompileTemplate(f template.FuncMap) error {
569570
body = c.Body
570571
}
571572

573+
body = gohtml.Format(body)
574+
572575
// Compile the campaign message.
573576
for _, r := range regTplFuncs {
574577
body = r.regExp.ReplaceAllString(body, r.replace)

0 commit comments

Comments
 (0)