Merge pull request #831 from david1hyman/file-decryption-fix
File decryption path was writing incorrect stream to file
This commit is contained in:
commit
4ae09b8716
|
@ -74,7 +74,7 @@ internal class DefaultFileService @Inject constructor(private val context: Conte
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val response = okHttpClient.newCall(request).execute()
|
val response = okHttpClient.newCall(request).execute()
|
||||||
val inputStream = response.body?.byteStream()
|
var inputStream = response.body?.byteStream()
|
||||||
Timber.v("Response size ${response.body?.contentLength()} - Stream available: ${inputStream?.available()}")
|
Timber.v("Response size ${response.body?.contentLength()} - Stream available: ${inputStream?.available()}")
|
||||||
if (!response.isSuccessful
|
if (!response.isSuccessful
|
||||||
|| inputStream == null) {
|
|| inputStream == null) {
|
||||||
|
@ -83,7 +83,7 @@ internal class DefaultFileService @Inject constructor(private val context: Conte
|
||||||
|
|
||||||
if (elementToDecrypt != null) {
|
if (elementToDecrypt != null) {
|
||||||
Timber.v("## decrypt file")
|
Timber.v("## decrypt file")
|
||||||
MXEncryptedAttachments.decryptAttachment(inputStream, elementToDecrypt)
|
inputStream = MXEncryptedAttachments.decryptAttachment(inputStream, elementToDecrypt)
|
||||||
?: throw IllegalStateException("Decryption error")
|
?: throw IllegalStateException("Decryption error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue