🚑 Fix crash on snapshot download fail (form NC) #28

Check if file exist before trying to delete it
This commit is contained in:
Sebastien Clement 2020-11-09 11:45:16 +01:00
parent 097f8d04f5
commit 1237f9c6ff

View File

@ -326,6 +326,7 @@ class WebdavTools {
logger.debug("Backup dl size : " + (fs.statSync(tmpFile).size / 1024 / 1024)); logger.debug("Backup dl size : " + (fs.statSync(tmpFile).size / 1024 / 1024));
resolve(tmpFile); resolve(tmpFile);
}).catch((err)=>{ }).catch((err)=>{
if(fs.existsSync(tmpFile))
fs.unlinkSync(tmpFile); fs.unlinkSync(tmpFile);
status.status = "error"; status.status = "error";
status.message = "Fail to download Hassio snapshot (" + err.message + ")"; status.message = "Fail to download Hassio snapshot (" + err.message + ")";