mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +00:00
Normalize attachments
This commit is contained in:
parent
26c9312c96
commit
21457f908c
2 changed files with 20 additions and 1 deletions
|
@ -265,7 +265,7 @@ public class ActivityEML extends ActivityBase {
|
|||
result.sent = helper.getSent();
|
||||
result.received = helper.getReceived();
|
||||
result.subject = helper.getSubject();
|
||||
result.parts = helper.getMessageParts();
|
||||
result.parts = helper.getMessageParts(false);
|
||||
|
||||
String html = result.parts.getHtml(context);
|
||||
if (html != null) {
|
||||
|
|
|
@ -1938,6 +1938,18 @@ public class MessageHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
void normalize() {
|
||||
Boolean plain = isPlainOnly();
|
||||
if (plain == null || plain)
|
||||
for (AttachmentPart apart : attachments)
|
||||
if (!TextUtils.isEmpty(apart.attachment.cid) ||
|
||||
!Part.ATTACHMENT.equals(apart.attachment.disposition)) {
|
||||
Log.i("Normalizing " + apart.attachment);
|
||||
apart.attachment.cid = null;
|
||||
apart.attachment.disposition = Part.ATTACHMENT;
|
||||
}
|
||||
}
|
||||
|
||||
Long getBodySize() throws MessagingException {
|
||||
Long size = null;
|
||||
|
||||
|
@ -2542,6 +2554,10 @@ public class MessageHelper {
|
|||
}
|
||||
|
||||
MessageParts getMessageParts() throws IOException, MessagingException {
|
||||
return getMessageParts(true);
|
||||
}
|
||||
|
||||
MessageParts getMessageParts(boolean normalize) throws IOException, MessagingException {
|
||||
MessageParts parts = new MessageParts();
|
||||
|
||||
try {
|
||||
|
@ -2678,6 +2694,9 @@ public class MessageHelper {
|
|||
*/
|
||||
}
|
||||
|
||||
if (normalize)
|
||||
parts.normalize();
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue