diff --git a/app/src/main/java/io/legado/app/help/storage/Backup.kt b/app/src/main/java/io/legado/app/help/storage/Backup.kt index 995ff8fdd..b6960c41e 100644 --- a/app/src/main/java/io/legado/app/help/storage/Backup.kt +++ b/app/src/main/java/io/legado/app/help/storage/Backup.kt @@ -107,7 +107,8 @@ object Backup { private fun copyBackup(context: Context, uri: Uri) { DocumentFile.fromTreeUri(context, uri)?.let { treeDoc -> for (fileName in backupFileNames) { - treeDoc.createFile("text/plain", fileName)?.let { doc -> + val doc = treeDoc.findFile(fileName) ?: treeDoc.createFile("text/plain", fileName) + doc?.let { DocumentUtils.writeText( context, FileHelp.getFile(backupPath + File.separator + fileName).readText(),