diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 48514c700a..36ba592951 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -6792,9 +6792,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. EntityMessage message = db.message().getMessage(id); if (message == null) throw new MessageRemovedException(); + File file = message.getRawFile(context); Log.i("Raw file=" + file); + if (!file.exists()) + db.message().setMessageRaw(message.id, false); + OutputStream os = null; InputStream is = null; try { diff --git a/app/src/main/java/eu/faircode/email/WorkerCleanup.java b/app/src/main/java/eu/faircode/email/WorkerCleanup.java index f8fdbf0637..2ec347aeda 100644 --- a/app/src/main/java/eu/faircode/email/WorkerCleanup.java +++ b/app/src/main/java/eu/faircode/email/WorkerCleanup.java @@ -237,6 +237,10 @@ public class WorkerCleanup extends Worker { if (manual || file.lastModified() + KEEP_FILES_DURATION < now) { long id = Long.parseLong(file.getName().split("\\.")[0]); EntityMessage message = db.message().getMessage(id); + if (manual && cleanup_attachments && message != null) { + message.raw = false; + db.message().setMessageRaw(message.id, message.raw); + } if (message == null || message.raw == null || !message.raw) { Log.i("Deleting " + file); if (!file.delete())