diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index b3dd2a8065..244bc5f82e 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -584,7 +584,9 @@ class Core { EntityOperation.HEADERS.equals(op.name) || EntityOperation.RAW.equals(op.name) || EntityOperation.ATTACHMENT.equals(op.name) || - (EntityOperation.ADD.equals(op.name) && + ((op.tries >= LOCAL_RETRY_MAX || + db.attachment().countAttachments(op.message) > 0) && + EntityOperation.ADD.equals(op.name) && EntityFolder.DRAFTS.equals(folder.type)) || (op.tries >= LOCAL_RETRY_MAX && EntityOperation.SYNC.equals(op.name) && diff --git a/app/src/main/java/eu/faircode/email/DaoAttachment.java b/app/src/main/java/eu/faircode/email/DaoAttachment.java index 925f38b8d9..2d1b7d4d65 100644 --- a/app/src/main/java/eu/faircode/email/DaoAttachment.java +++ b/app/src/main/java/eu/faircode/email/DaoAttachment.java @@ -43,6 +43,10 @@ public interface DaoAttachment { " ORDER BY sequence, subsequence") List getAttachments(long message); + @Query("SELECT COUNT(*) FROM attachment" + + " WHERE message = :message") + int countAttachments(long message); + @Query("SELECT * FROM attachment" + " WHERE id = :id") EntityAttachment getAttachment(long id);