Skip to content

Commit

Permalink
Merge branch '719-truncate-backup-files' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Mar 12, 2020
2 parents a0c1d8a + d0098d9 commit c802944
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ private int exportData(File exportPath, @BackupType int type) {
}
FileOutputStream out = new FileOutputStream(pfd.getFileDescriptor());

// Even though using streams and FileOutputStream does not append by
// default, using Storage Access Framework just overwrites existing
// bytes, potentially leaving old bytes hanging over:
// so truncate the file first to clear any existing bytes.
out.getChannel().truncate(0);

if (type == BACKUP_SHOWS) {
writeJsonStreamShows(out, data);
} else if (type == BACKUP_LISTS) {
Expand Down

0 comments on commit c802944

Please sign in to comment.