From 566196cafdccd193a282d895a40e25cdf0f561c7 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 8 May 2019 09:20:56 +0200 Subject: [PATCH] Fixed duplicate attachment CIDs fixing --- .../java/eu/faircode/email/MessageHelper.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 15533ade2e..f036150cb9 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -824,21 +824,8 @@ public class MessageHelper { List getAttachments() { List result = new ArrayList<>(); - for (AttachmentPart apart : attachments) result.add(apart.attachment); - - // Fix duplicate CIDs - for (int i = 0; i < result.size(); i++) { - String cid = result.get(i).cid; - if (cid != null) - for (int j = i + 1; j < result.size(); j++) { - EntityAttachment a = result.get(j); - if (cid.equals(a.cid)) - a.cid = null; - } - } - return result; } @@ -938,6 +925,18 @@ public class MessageHelper { getMessageParts(cmessage, parts, false); + // Fix duplicate CIDs + List attachments = parts.getAttachments(); + for (int i = 0; i < attachments.size(); i++) { + String cid = attachments.get(i).cid; + if (cid != null) + for (int j = i + 1; j < attachments.size(); j++) { + EntityAttachment a = attachments.get(j); + if (cid.equals(a.cid)) + a.cid = null; + } + } + return parts; }