mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-16 01:05:04 +01:00
close streams after use
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
5ac4dccda6
commit
8acb646383
@ -1551,6 +1551,11 @@ class ChatController(args: Bundle) :
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
try {
|
||||
fd.close()
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, "Failed to close AssetFileDescriptor", e)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
|
@ -55,8 +55,10 @@ class FileUploader(
|
||||
try {
|
||||
val input: InputStream = context.contentResolver.openInputStream(sourceFileUri)!!
|
||||
val buf = ByteArray(input.available())
|
||||
while (input.read(buf) != -1)
|
||||
while (input.read(buf) != -1) {
|
||||
requestBody = RequestBody.create("application/octet-stream".toMediaTypeOrNull(), buf)
|
||||
}
|
||||
input.close()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "failed to create RequestBody for $sourceFileUri", e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user