From 5e39d3c6fb10850052face2598637df5c67619a3 Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 15 Sep 2020 10:03:49 +0200 Subject: [PATCH] output stream not closed --- CHANGES.md | 1 + .../sdk/internal/session/DefaultFileService.kt | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f7c7f9d044..d5c3df0521 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Improvements 🙌: Bugfix 🐛: - Clear the notification when the event is read elsewhere (#1822) - Speakerphone is not used for ringback tone (#1644, #1645) + - Various report of people that cannot play video (#2107) Translations 🗣: - diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt index aa4114c8c2..a163cd4809 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt @@ -144,11 +144,13 @@ internal class DefaultFileService @Inject constructor( if (elementToDecrypt != null) { Timber.v("## FileService: decrypt file") - val decryptSuccess = MXEncryptedAttachments.decryptAttachment( - source.inputStream(), - elementToDecrypt, - destFile.outputStream().buffered() - ) + val decryptSuccess = destFile.outputStream().buffered().use { + MXEncryptedAttachments.decryptAttachment( + source.inputStream(), + elementToDecrypt, + it + ) + } response.close() if (!decryptSuccess) { return@flatMap Try.Failure(IllegalStateException("Decryption error"))