mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-21 19:55:07 +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)
|
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) {
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||||
|
@ -55,8 +55,10 @@ class FileUploader(
|
|||||||
try {
|
try {
|
||||||
val input: InputStream = context.contentResolver.openInputStream(sourceFileUri)!!
|
val input: InputStream = context.contentResolver.openInputStream(sourceFileUri)!!
|
||||||
val buf = ByteArray(input.available())
|
val buf = ByteArray(input.available())
|
||||||
while (input.read(buf) != -1)
|
while (input.read(buf) != -1) {
|
||||||
requestBody = RequestBody.create("application/octet-stream".toMediaTypeOrNull(), buf)
|
requestBody = RequestBody.create("application/octet-stream".toMediaTypeOrNull(), buf)
|
||||||
|
}
|
||||||
|
input.close()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "failed to create RequestBody for $sourceFileUri", e)
|
Log.e(TAG, "failed to create RequestBody for $sourceFileUri", e)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user