Fix crash when downloading attachment from S3.

This commit is contained in:
Greyson Parrelli
2024-09-10 20:47:13 -04:00
committed by Cody Henthorne
parent 36a8a399d9
commit 7735ca9dab
2 changed files with 8 additions and 3 deletions

View File

@@ -416,11 +416,15 @@ class AttachmentDownloadJob private constructor(
if (body.contentLength() > RemoteConfig.maxAttachmentReceiveSizeBytes) {
throw MmsException("Attachment too large, failing download")
}
SignalDatabase.attachments.createKeyIvIfNecessary(attachmentId)
val updatedAttachment = SignalDatabase.attachments.getAttachment(attachmentId)!!
SignalDatabase.attachments.finalizeAttachmentAfterDownload(
messageId,
attachmentId,
LimitedInputStream.withoutLimits((body.source() as Source).buffer().inputStream()),
iv = null
iv = updatedAttachment.remoteIv
)
}
}