Merge pull request #2108 from vector-im/feature/fix_cannnot_play_video

output stream not closed
This commit is contained in:
Valere 2020-09-15 10:33:56 +02:00 committed by GitHub
commit 653d6c6050
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -11,6 +11,7 @@ Improvements 🙌:
Bugfix 🐛: Bugfix 🐛:
- Clear the notification when the event is read elsewhere (#1822) - Clear the notification when the event is read elsewhere (#1822)
- Speakerphone is not used for ringback tone (#1644, #1645) - Speakerphone is not used for ringback tone (#1644, #1645)
- Various report of people that cannot play video (#2107)
Translations 🗣: Translations 🗣:
- -

View file

@ -144,11 +144,13 @@ internal class DefaultFileService @Inject constructor(
if (elementToDecrypt != null) { if (elementToDecrypt != null) {
Timber.v("## FileService: decrypt file") Timber.v("## FileService: decrypt file")
val decryptSuccess = MXEncryptedAttachments.decryptAttachment( val decryptSuccess = destFile.outputStream().buffered().use {
source.inputStream(), MXEncryptedAttachments.decryptAttachment(
elementToDecrypt, source.inputStream(),
destFile.outputStream().buffered() elementToDecrypt,
) it
)
}
response.close() response.close()
if (!decryptSuccess) { if (!decryptSuccess) {
return@flatMap Try.Failure(IllegalStateException("Decryption error")) return@flatMap Try.Failure(IllegalStateException("Decryption error"))