From 8836c85a343b1499ad0710b260856c1be9ae5c53 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 6 Mar 2023 20:32:30 +0100 Subject: [PATCH] Remove br from paragraphs only --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 0feebb76fa..488fac9af7 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -1115,8 +1115,9 @@ public class HtmlHelper { // Breaks for (Element br : document.select("br")) { Element parent = br.parent(); - Element last = (parent == null ? null : parent.lastElementChild()); - if (br == last) + if (parent == null || !"p".equals(parent.tagName())) + continue; + if (br == parent.lastElementChild()) br.remove(); }