Merge pull request #5820 from cketti/fix_export_overwriting_file
Truncate existing file when exporting OPML/HTML/Favorites
This commit is contained in:
commit
0e55ff2c30
|
@ -36,7 +36,7 @@ public class DocumentFileExportWorker {
|
||||||
OutputStreamWriter writer = null;
|
OutputStreamWriter writer = null;
|
||||||
try {
|
try {
|
||||||
Uri uri = output.getUri();
|
Uri uri = output.getUri();
|
||||||
outputStream = context.getContentResolver().openOutputStream(uri);
|
outputStream = context.getContentResolver().openOutputStream(uri, "wt");
|
||||||
if (outputStream == null) {
|
if (outputStream == null) {
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class DatabaseExporter {
|
||||||
ParcelFileDescriptor pfd = null;
|
ParcelFileDescriptor pfd = null;
|
||||||
FileOutputStream fileOutputStream = null;
|
FileOutputStream fileOutputStream = null;
|
||||||
try {
|
try {
|
||||||
pfd = context.getContentResolver().openFileDescriptor(uri, "w");
|
pfd = context.getContentResolver().openFileDescriptor(uri, "wt");
|
||||||
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
|
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
|
||||||
exportToStream(fileOutputStream, context);
|
exportToStream(fileOutputStream, context);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue