Skip to content

Commit

Permalink
Fix #40 Delete existing temporary zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
JackGruber committed Jul 27, 2022
1 parent ef95378 commit 6e48c68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fix: #45 Error message when deleting old ZIP backupsets
- Disable Joplin DirectoryPath selector and use string input again because of several bugs [#6692](https://github.com/laurent22/joplin/issues/6692) and [#6693](https://github.com/laurent22/joplin/issues/6693)
- Fix: #40 Delete existing temporary zip file to prevent adding files to an old aborted backup

## v1.1.0 (2022-07-11)

Expand Down
14 changes: 13 additions & 1 deletion src/Backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,20 @@ class Backup {
this.zipArchive === "yesone" ||
(this.singleJex === true && this.zipArchive === "yes")
) {
const singleZipFile = path.join(
this.backupBasePath,
"newJoplinBackup.7z"
);

if (fs.existsSync(singleZipFile)) {
this.log.warn(
`New Single ZIP already exist, delete file: ` + singleZipFile
);
fs.unlinkSync(singleZipFile);
}

zipFile = await this.addToZipArchive(
path.join(this.backupBasePath, "newJoplinBackup.7z"),
singleZipFile,
path.join(this.activeBackupPath, "*"),
this.password
);
Expand Down

0 comments on commit 6e48c68

Please sign in to comment.