mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Mark attachment 404's as permanent failures.
This commit is contained in:
committed by
Cody Henthorne
parent
121f0c6134
commit
65a30cf2a7
@@ -153,7 +153,7 @@ abstract class Attachment(
|
||||
* Denotes whether the media for the given attachment is no longer available for download.
|
||||
*/
|
||||
val isMediaNoLongerAvailableForDownload: Boolean
|
||||
get() = isPermanentlyFailed && uploadTimestamp.milliseconds > 30.days
|
||||
get() = isPermanentlyFailed && (System.currentTimeMillis().milliseconds - uploadTimestamp.milliseconds) > 30.days
|
||||
|
||||
val isSticker: Boolean
|
||||
get() = stickerLocator != null
|
||||
|
||||
@@ -441,6 +441,8 @@ class RestoreAttachmentJob private constructor(
|
||||
if (attachment.dataHash != null) {
|
||||
maybePostFailedToDownloadFromArchiveAndTransitNotification()
|
||||
}
|
||||
markPermanentlyFailed(attachmentId)
|
||||
return
|
||||
} 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. hasPlaintextHash: ${attachment.dataHash != null}")
|
||||
if (attachment.dataHash != null) {
|
||||
@@ -453,8 +455,12 @@ class RestoreAttachmentJob private constructor(
|
||||
if (attachment.dataHash != null) {
|
||||
maybePostFailedToDownloadFromArchiveAndTransitNotification()
|
||||
}
|
||||
markPermanentlyFailed(attachmentId)
|
||||
return
|
||||
} 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.")
|
||||
markPermanentlyFailed(attachmentId)
|
||||
return
|
||||
}
|
||||
}
|
||||
401 -> {
|
||||
@@ -491,9 +497,9 @@ class RestoreAttachmentJob private constructor(
|
||||
SignalDatabase.attachments.clearIncrementalMacsForAttachmentAndAnyDuplicates(attachmentId, attachment.remoteKey, attachment.dataHash)
|
||||
}
|
||||
markFailed(attachmentId)
|
||||
} finally {
|
||||
attachmentFile.delete()
|
||||
}
|
||||
|
||||
attachmentFile.delete()
|
||||
}
|
||||
|
||||
private fun markFailed(attachmentId: AttachmentId) {
|
||||
|
||||
Reference in New Issue
Block a user