Merge pull request #5820 from cketti/fix_export_overwriting_file

Truncate existing file when exporting OPML/HTML/Favorites
This commit is contained in:
ByteHamster 2022-04-01 21:10:39 +02:00 committed by GitHub
commit 0e55ff2c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ public class DocumentFileExportWorker {
OutputStreamWriter writer = null;
try {
Uri uri = output.getUri();
outputStream = context.getContentResolver().openOutputStream(uri);
outputStream = context.getContentResolver().openOutputStream(uri, "wt");
if (outputStream == null) {
throw new IOException();
}

View File

@ -27,7 +27,7 @@ public class DatabaseExporter {
ParcelFileDescriptor pfd = null;
FileOutputStream fileOutputStream = null;
try {
pfd = context.getContentResolver().openFileDescriptor(uri, "w");
pfd = context.getContentResolver().openFileDescriptor(uri, "wt");
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
exportToStream(fileOutputStream, context);
} catch (IOException e) {