From f777cf6d116e445018cbda1331e2a9cefc4a0e9c Mon Sep 17 00:00:00 2001 From: mlamalle Date: Thu, 13 Mar 2025 09:14:10 +0100 Subject: [PATCH] add allowed styles elements to render html --- internal/route/email.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/route/email.go b/internal/route/email.go index 24c8470..85419f7 100644 --- a/internal/route/email.go +++ b/internal/route/email.go @@ -81,6 +81,8 @@ func serveEmailHTMLContent(w http.ResponseWriter, r *http.Request) { } policy := bluemonday.UGCPolicy() + policy.AllowAttrs("style", "color", "bgcolor").OnElements("h1", "h2", "h3", "h4", "h5", "h6", "p", "ul", "ol", "li", "a", "br", "strong", "em", "i", "b", "u", "span", "div", "table", "thead", "tbody", "tr", "th", "td", "img") + sanitizedHTML := policy.Sanitize(email.HTML) w.Header().Set("Content-Type", "text/html")