From df26391c5714cd590d0acfd13f7ce4c737508d75 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Sun, 24 May 2020 18:59:15 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20remove=20top=20level=20
=20t?= =?UTF-8?q?ags=20that=20separate=20text=20nodes=20(Apple=20calendar=20aler?= =?UTF-8?q?ts)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/services/quoted-html-transformer.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/services/quoted-html-transformer.ts b/app/src/services/quoted-html-transformer.ts index 55235c0ec..aa6c18ae0 100644 --- a/app/src/services/quoted-html-transformer.ts +++ b/app/src/services/quoted-html-transformer.ts @@ -105,12 +105,13 @@ class QuotedHTMLTransformer { return; } - // Find back-to-back

at the top level and de-duplicate them - const { children } = doc.body; + // Find back-to-back

at the top level and de-duplicate them. Note that + // some emails contain TEXT
TEXT
TEXT, so the only ELEMENT children may be the + const nodes = doc.body.childNodes; const extraTailBrTags = []; - for (let i = children.length - 1; i >= 0; i--) { - const curr = children[i]; - const next = children[i - 1]; + for (let i = nodes.length - 1; i >= 0; i--) { + const curr = nodes[i]; + const next = nodes[i - 1]; if (curr && curr.nodeName === 'BR' && next && next.nodeName === 'BR') { extraTailBrTags.push(curr); } else {