From b9e0d9978bc8a5709cd464fe6676f7034ba51e49 Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 29 Oct 2025 08:54:49 -0400 Subject: [PATCH] Delete attachment transfer files after restore or download. --- .../org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.kt | 2 ++ .../org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.kt index 4039a56851..50bb8d12fd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.kt @@ -352,6 +352,8 @@ class AttachmentDownloadJob private constructor( SignalDatabase.attachments.clearIncrementalMacsForAttachmentAndAnyDuplicates(attachmentId, attachment.remoteKey, attachment.dataHash) markFailed(messageId, attachmentId) } + + attachmentFile.delete() } @Throws(InvalidAttachmentException::class) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt index bcdf9cd25a..f4fd69017c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt @@ -468,6 +468,8 @@ class RestoreAttachmentJob private constructor( SignalDatabase.attachments.clearIncrementalMacsForAttachmentAndAnyDuplicates(attachmentId, attachment.remoteKey, attachment.dataHash) markFailed(attachmentId) } + + attachmentFile.delete() } private fun markFailed(attachmentId: AttachmentId) {