mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-25 02:22:58 +01:00
🚑 Fix crash on backup upload to ha
This commit is contained in:
parent
fdaa188831
commit
084af91620
@ -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}` },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user