From 5ef3f1d98feb86b61f86048cb8487186c4c33dab Mon Sep 17 00:00:00 2001 From: drew Date: Mon, 28 Jul 2025 21:14:12 +0400 Subject: [PATCH] fix: remove css and script from email view (#5) --- view/html.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/html.go b/view/html.go index 2192b70a36ba8c89ec2c92973db9d774ac16fd5f..37487482377f91d08d33b6c63bcb64f8e924593f 100644 --- a/view/html.go +++ b/view/html.go @@ -40,6 +40,9 @@ func ProcessBody(rawBody string) (string, error) { return "", fmt.Errorf("could not parse email body: %w", err) } + // Remove style and script tags to clean up the view + doc.Find("style, script").Remove() + // Add newlines after block elements for better spacing doc.Find("p, div, h1, h2, h3, h4, h5, h6").Each(func(i int, s *goquery.Selection) { s.After("\n\n")