From ae993fb15edcf287a5ae481f08d26543ae50c116 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 14 Apr 2020 16:28:31 +0200 Subject: [PATCH] Workaround attachments used as inline images --- app/src/main/java/eu/faircode/email/AdapterMessage.java | 6 ++---- app/src/main/java/eu/faircode/email/EntityAttachment.java | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index d45353b47c..5cbe770c37 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -1486,8 +1486,6 @@ public class AdapterMessage extends RecyclerView.Adapter>() { @Override public void onChanged(@Nullable List attachments) { - bindAttachments(message, attachments); - int inlineImages = 0; if (attachments != null) for (EntityAttachment attachment : attachments) @@ -1501,10 +1499,10 @@ public class AdapterMessage extends RecyclerView.Adapter lastInlineImages) bindBody(message, false); - properties.setAttachments(message.id, attachments); + bindAttachments(message, attachments); } }); diff --git a/app/src/main/java/eu/faircode/email/EntityAttachment.java b/app/src/main/java/eu/faircode/email/EntityAttachment.java index 327c03223d..ce976a700e 100644 --- a/app/src/main/java/eu/faircode/email/EntityAttachment.java +++ b/app/src/main/java/eu/faircode/email/EntityAttachment.java @@ -38,8 +38,6 @@ import java.util.List; import java.util.Locale; import java.util.Objects; -import javax.mail.Part; - import static androidx.room.ForeignKey.CASCADE; @Entity( @@ -99,7 +97,8 @@ public class EntityAttachment { public String error; boolean isInline() { - return ((Part.INLINE.equals(disposition) || TextUtils.isEmpty(name)) && cid != null); + // Gmail sends inline images as attachments with a name and cid + return (cid != null); } boolean isImage() {