mirror of
https://github.com/mollyim/mollyim-insider-android.git
synced 2025-05-12 21:30:40 +01:00
Fix error handling for resumable uploads to cdn3.
This commit is contained in:
parent
fcf3c4867b
commit
8365310bb5
2 changed files with 8 additions and 4 deletions
|
@ -32,6 +32,7 @@ import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil
|
|||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResumableUploadResponseCodeException
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ResumeLocationInvalidException
|
||||
import org.whispersystems.signalservice.internal.crypto.PaddingInputStream
|
||||
import java.io.IOException
|
||||
import java.util.Optional
|
||||
|
@ -167,6 +168,11 @@ class AttachmentUploadJob private constructor(
|
|||
uploadSpec = null
|
||||
}
|
||||
|
||||
throw e
|
||||
} catch (e: ResumeLocationInvalidException) {
|
||||
Log.w(TAG, "Resume location invalid. Clearing upload spec.", e)
|
||||
uploadSpec = null
|
||||
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2068,11 +2068,9 @@ public class PushServiceSocket {
|
|||
|
||||
try (Response response = call.execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
offset = Long.parseLong(response.header("Upload-Offset"));
|
||||
} else if (response.code() >= 400 || response.code() < 500) {
|
||||
throw new ResumeLocationInvalidException("Response: " + response);
|
||||
offset = Long.parseLong(Objects.requireNonNull(response.header("Upload-Offset")));
|
||||
} else {
|
||||
throw new NonSuccessfulResumableUploadResponseCodeException(response.code(), "Response: " + response);
|
||||
throw new ResumeLocationInvalidException("Response: " + response);
|
||||
}
|
||||
} catch (PushNetworkException | NonSuccessfulResponseCodeException e) {
|
||||
throw e;
|
||||
|
|
Loading…
Reference in a new issue