Truncate files when writing to them explicitly

For some reason this wasn't an issue on Pie,
but an instrumentation test caught the change in behavior on Q.
This commit is contained in:
Torsten Grote 2019-09-20 09:42:59 -03:00
parent e659892278
commit bf28bc3338
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF

View file

@ -100,7 +100,7 @@ class DocumentsStorage(private val context: Context, storage: Storage?, token: L
@Throws(IOException::class)
fun getOutputStream(file: DocumentFile): OutputStream {
return context.contentResolver.openOutputStream(file.uri) ?: throw IOException()
return context.contentResolver.openOutputStream(file.uri, "wt") ?: throw IOException()
}
}