mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Fixed duplicate attachment CIDs fixing
This commit is contained in:
parent
1db989d846
commit
566196cafd
1 changed files with 12 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue