From 2a3e684c191624b300dbfa9a071df9dd551ed8e5 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Tue, 22 Mar 2022 21:05:00 +0000 Subject: [PATCH] fix: overwriting files on SD card --- .../kotlin/com/simplemobiletools/commons/extensions/Activity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt index d0c78dc2a..55d386c4b 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt @@ -1162,7 +1162,7 @@ fun BaseSimpleActivity.getFileOutputStreamSync(path: String, mimeType: String, p } try { - val newDocument = documentFile.createFile(mimeType, path.getFilenameFromPath()) ?: getDocumentFile(path) + val newDocument = getDocumentFile(path) ?: documentFile.createFile(mimeType, path.getFilenameFromPath()) applicationContext.contentResolver.openOutputStream(newDocument!!.uri) } catch (e: Exception) { showErrorToast(e)