From b4d662cce48824db835bf73c0274fead3cb2c7de Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 14 Sep 2017 02:29:30 -0400 Subject: PLT-7563 Fixed template handling to support more values (#7404) --- utils/html.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'utils/html.go') diff --git a/utils/html.go b/utils/html.go index dfbbe832d..fdba3e08d 100644 --- a/utils/html.go +++ b/utils/html.go @@ -7,6 +7,7 @@ import ( "bytes" "html/template" "net/http" + "reflect" l4g "github.com/alecthomas/log4go" "github.com/fsnotify/fsnotify" @@ -94,7 +95,7 @@ func (t *HTMLTemplate) addDefaultProps() { } t.Html["EmailInfo"] = TranslateAsHtml(localT, "api.templates.email_info", - map[string]interface{}{"SupportEmail": Cfg.SupportSettings.SupportEmail, "SiteName": Cfg.TeamSettings.SiteName}) + map[string]interface{}{"SupportEmail": *Cfg.SupportSettings.SupportEmail, "SiteName": Cfg.TeamSettings.SiteName}) } func (t *HTMLTemplate) Render() string { @@ -128,6 +129,8 @@ func escapeForHtml(arg interface{}) interface{} { switch typedArg := arg.(type) { case string: return template.HTMLEscapeString(typedArg) + case *string: + return template.HTMLEscapeString(*typedArg) case map[string]interface{}: safeArg := make(map[string]interface{}, len(typedArg)) for key, value := range typedArg { @@ -135,7 +138,7 @@ func escapeForHtml(arg interface{}) interface{} { } return safeArg default: - l4g.Warn("Unable to escape value for HTML template %v", arg) + l4g.Warn("Unable to escape value for HTML template %v of type %v", arg, reflect.ValueOf(arg).Type()) return "" } } -- cgit v1.2.3-1-g7c22