mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 15:11:42 +01:00
Clear upload spec when resume location is invalid in archive upload.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
jeffrey-signal
parent
cbf770d3ea
commit
ff15c8417a
@@ -54,6 +54,7 @@ import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.NetworkResult
|
||||
import org.whispersystems.signalservice.api.messages.AttachmentTransferProgress
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ResumeLocationInvalidException
|
||||
import org.whispersystems.signalservice.api.svr.SvrBApi
|
||||
import org.whispersystems.signalservice.internal.push.AttachmentUploadForm
|
||||
import java.io.File
|
||||
@@ -367,6 +368,10 @@ class BackupMessagesJob private constructor(
|
||||
is NetworkResult.Success -> Unit
|
||||
is NetworkResult.NetworkError -> {
|
||||
Log.i(TAG, "Network failure", uploadResult.getCause(), true)
|
||||
if (uploadResult.exception is ResumeLocationInvalidException) {
|
||||
Log.w(TAG, "Resume location is invalid. Clearing upload spec before retrying.")
|
||||
resumableMessagesBackupUploadSpec = null
|
||||
}
|
||||
return if (isCanceled) Result.failure() else Result.retry(defaultBackoff())
|
||||
}
|
||||
is NetworkResult.StatusCodeError -> {
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.whispersystems.signalservice.api.archive.ArchiveMediaUploadFormStatus
|
||||
import org.whispersystems.signalservice.api.attachment.AttachmentUploadResult
|
||||
import org.whispersystems.signalservice.api.messages.AttachmentTransferProgress
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ResumeLocationInvalidException
|
||||
import org.whispersystems.signalservice.internal.push.AttachmentUploadForm
|
||||
import org.whispersystems.signalservice.internal.push.http.ResumableUploadSpec
|
||||
import java.io.FileNotFoundException
|
||||
@@ -318,7 +319,10 @@ class UploadAttachmentToArchiveJob private constructor(
|
||||
is NetworkResult.NetworkError -> {
|
||||
Log.w(TAG, "[$attachmentId]$mediaIdLog Failed to upload due to network error.", result.exception)
|
||||
|
||||
if (result.exception.cause is ProtocolException) {
|
||||
if (result.exception is ResumeLocationInvalidException) {
|
||||
Log.w(TAG, "[$attachmentId]$mediaIdLog Resume location is invalid. Clearing upload spec before retrying.")
|
||||
uploadSpec = null
|
||||
} else if (result.exception.cause is ProtocolException) {
|
||||
Log.w(TAG, "[$attachmentId]$mediaIdLog Length may be incorrect. Recalculating.", result.exception)
|
||||
|
||||
val actualLength = SignalDatabase.attachments.getAttachmentStream(attachmentId, 0)
|
||||
|
||||
Reference in New Issue
Block a user