From baaed52144ee6600f2f320acb19a062a48f44c48 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 29 Mar 2022 20:56:41 +0200 Subject: [PATCH] Remove CID on converting inline image to attachment --- app/src/main/java/eu/faircode/email/DaoAttachment.java | 6 +++--- app/src/main/java/eu/faircode/email/FragmentCompose.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoAttachment.java b/app/src/main/java/eu/faircode/email/DaoAttachment.java index d260f9390e..41a993a109 100644 --- a/app/src/main/java/eu/faircode/email/DaoAttachment.java +++ b/app/src/main/java/eu/faircode/email/DaoAttachment.java @@ -115,10 +115,10 @@ public interface DaoAttachment { void setType(long id, String type); @Query("UPDATE attachment" + - " SET disposition = :disposition" + + " SET disposition = :disposition, cid = :cid" + " WHERE id = :id" + - " AND NOT (disposition IS :disposition)") - void setDisposition(long id, String disposition); + " AND NOT (disposition IS :disposition AND cid IS :cid)") + void setDisposition(long id, String disposition, String cid); @Query("UPDATE attachment" + " SET cid = :cid" + diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b950453450..e92a4171d7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -5769,7 +5769,8 @@ public class FragmentCompose extends FragmentBase { if (attachment.isInline() && attachment.isImage()) { Log.i("Converting to attachment cid=" + attachment.cid); attachment.disposition = Part.ATTACHMENT; - db.attachment().setDisposition(attachment.id, attachment.disposition); + attachment.cid = null; + db.attachment().setDisposition(attachment.id, attachment.disposition, attachment.cid); dirty = true; } }