🚑 Fix crash on backup upload to ha

This commit is contained in:
SebClem 2022-04-30 15:19:16 +02:00
parent fdaa188831
commit 084af91620
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -189,20 +189,20 @@ function downloadSnapshot(id) {
}), }),
stream stream
) )
.then((res) => { .then(() => {
logger.info("Download success !"); logger.info("Download success !");
status.progress = 1; status.progress = 1;
statusTools.setStatus(status); statusTools.setStatus(status);
logger.debug("Snapshot dl size : " + fs.statSync(tmp_file).size / 1024 / 1024); logger.debug("Snapshot dl size : " + fs.statSync(tmp_file).size / 1024 / 1024);
resolve(); resolve();
}) })
.catch((err) => { .catch((error) => {
fs.unlinkSync(tmp_file); fs.unlinkSync(tmp_file);
statusTools.setError(`Fail to download Hassio backup (${error.message})`, 7); statusTools.setError(`Fail to download Hassio backup (${error.message})`, 7);
reject(`Fail to download Hassio backup (${error.message})`); reject(`Fail to download Hassio backup (${error.message})`);
}); });
}) })
.catch((err) => { .catch(() => {
statusTools.setError("Fail to download Hassio backup. Not found ?", 7); statusTools.setError("Fail to download Hassio backup. Not found ?", 7);
reject(); reject();
}); });
@ -213,7 +213,6 @@ function dellSnap(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
checkSnap(id) checkSnap(id)
.then(() => { .then(() => {
let option = { let option = {
headers: { "Authorization": `Bearer ${token}` }, headers: { "Authorization": `Bearer ${token}` },
responseType: "json", responseType: "json",
@ -332,8 +331,6 @@ function uploadSnapshot(path) {
let options = { let options = {
body: form, body: form,
username: this.username,
password: this.password,
headers: { "Authorization": `Bearer ${token}` }, headers: { "Authorization": `Bearer ${token}` },
}; };