Fixed duplicate attachment CIDs fixing

This commit is contained in:
M66B 2019-05-08 09:20:56 +02:00
parent 1db989d846
commit 566196cafd
1 changed files with 12 additions and 13 deletions

View File

@ -824,21 +824,8 @@ public class MessageHelper {
List<EntityAttachment> getAttachments() {
List<EntityAttachment> 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<EntityAttachment> 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;
}