From bf28bc33385dda1a56d7195871210e951c680863 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 20 Sep 2019 09:42:59 -0300 Subject: [PATCH] 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. --- .../backup/transport/backup/plugins/DocumentsStorage.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/stevesoltys/backup/transport/backup/plugins/DocumentsStorage.kt b/app/src/main/java/com/stevesoltys/backup/transport/backup/plugins/DocumentsStorage.kt index 806a2163..505dd86c 100644 --- a/app/src/main/java/com/stevesoltys/backup/transport/backup/plugins/DocumentsStorage.kt +++ b/app/src/main/java/com/stevesoltys/backup/transport/backup/plugins/DocumentsStorage.kt @@ -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() } }