diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-14 02:29:30 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-13 23:29:30 -0700 |
commit | b4d662cce48824db835bf73c0274fead3cb2c7de (patch) | |
tree | fce0737f2d84aec6597e04834f92ac7b307d2f82 /utils | |
parent | 156970293014ac8aa55a712e201b5a8a6ff762b1 (diff) | |
download | chat-b4d662cce48824db835bf73c0274fead3cb2c7de.tar.gz chat-b4d662cce48824db835bf73c0274fead3cb2c7de.tar.bz2 chat-b4d662cce48824db835bf73c0274fead3cb2c7de.zip |
PLT-7563 Fixed template handling to support more values (#7404)
Diffstat (limited to 'utils')
-rw-r--r-- | utils/html.go | 7 |
1 files changed, 5 insertions, 2 deletions
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 "" } } |