Skip to content

Commit

Permalink
Flush temporary export file before starting ExportTask
Browse files Browse the repository at this point in the history
The previous logic was not an issue because FileOutputStream is
unbuffered, but still, this is more correct.
  • Loading branch information
alexbakker committed Jan 24, 2025
1 parent ad2dc80 commit e8d712e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,10 @@ private void onExportResult(int requestCode, int resultCode, @Nullable Intent da
file = File.createTempFile(VaultRepository.FILENAME_PREFIX_EXPORT + "-", ".json", getExportCacheDir());
outStream = new FileOutputStream(file);
cb.exportVault(outStream);

new ExportTask(requireContext(), new ExportResultListener()).execute(getLifecycle(), new ExportTask.Params(file, uri));
} catch (VaultRepositoryException | IOException e) {
e.printStackTrace();
Dialogs.showErrorDialog(requireContext(), R.string.exporting_vault_error, e);
return;
} finally {
try {
if (outStream != null) {
Expand All @@ -532,6 +531,8 @@ private void onExportResult(int requestCode, int resultCode, @Nullable Intent da
e.printStackTrace();
}
}

new ExportTask(requireContext(), new ExportResultListener()).execute(getLifecycle(), new ExportTask.Params(file, uri));
}, _exportFilter);
_exportFilter = null;
}
Expand Down

0 comments on commit e8d712e

Please sign in to comment.