mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Allow raw cleanup
This commit is contained in:
parent
5e7bffe974
commit
600b664388
2 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue