From c8e0ba8194eb33639f429350a7c522f3b04e1b28 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Thu, 6 Nov 2025 15:32:35 -0500 Subject: [PATCH] Reduce error noise when failing to restore an attachment that was intentionally never uploaded. --- .../securesms/jobs/RestoreAttachmentJob.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 1ceaafc396..24efd32e47 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/RestoreAttachmentJob.kt @@ -458,16 +458,22 @@ class RestoreAttachmentJob private constructor( when (e.code) { 404 -> { if (forceTransitTier) { - Log.w(TAG, "[$attachmentId] Completely failed to restore an attachment! Failed downloading from both the archive and transit CDN.") - maybePostFailedToDownloadFromArchiveAndTransitNotification() + Log.w(TAG, "[$attachmentId] Completely failed to restore an attachment! Failed downloading from both the archive and transit CDN. hasPlaintextHash: ${attachment.dataHash != null}") + if (attachment.dataHash != null) { + maybePostFailedToDownloadFromArchiveAndTransitNotification() + } } else if (SignalStore.backup.backsUpMedia && attachment.remoteLocation.isNotNullOrBlank()) { - Log.w(TAG, "[$attachmentId] Failed to download attachment from the archive CDN! Retrying download from transit CDN.") - maybePostFailedToDownloadFromArchiveNotification() + Log.w(TAG, "[$attachmentId] Failed to download attachment from the archive CDN! Retrying download from transit CDN. hasPlaintextHash: ${attachment.dataHash != null}") + if (attachment.dataHash != null) { + maybePostFailedToDownloadFromArchiveNotification() + } return retrieveAttachment(messageId, attachmentId, attachment, forceTransitTier = true) } else if (SignalStore.backup.backsUpMedia) { - Log.w(TAG, "[$attachmentId] Completely failed to restore an attachment! Failed to download from archive CDN, and there's not transit CDN info.") - maybePostFailedToDownloadFromArchiveAndTransitNotification() + Log.w(TAG, "[$attachmentId] Completely failed to restore an attachment! Failed to download from archive CDN, and there's not transit CDN info. hasPlaintextHash: ${attachment.dataHash != null}") + if (attachment.dataHash != null) { + maybePostFailedToDownloadFromArchiveAndTransitNotification() + } } else if (attachment.remoteLocation.isNotNullOrBlank()) { Log.w(TAG, "[$attachmentId] Failed to restore an attachment for a free tier user. Likely just older than 45 days.") }