mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-10 03:22:58 +01:00
Check if file exist before deleting it
This commit is contained in:
parent
874eec7877
commit
3c6dcd9163
@ -1,4 +1,4 @@
|
|||||||
import { unlinkSync } from "fs";
|
import { existsSync, unlinkSync } from "fs";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import logger from "../config/winston.js";
|
import logger from "../config/winston.js";
|
||||||
import messageManager from "../tools/messageManager.js";
|
import messageManager from "../tools/messageManager.js";
|
||||||
@ -112,9 +112,10 @@ export function doBackupWorkflow(type: WorkflowType) {
|
|||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
backupFail();
|
backupFail();
|
||||||
if (tmpBackupFile != "") {
|
if (tmpBackupFile != "" && existsSync(tmpBackupFile)) {
|
||||||
unlinkSync(tmpBackupFile);
|
unlinkSync(tmpBackupFile);
|
||||||
}
|
}
|
||||||
|
homeAssistantService.startAddons(addonsToStartStop).catch(() => {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user