From ef67b8481eb7e555cf308c64e3ef7ec71739d90d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 11 Sep 2020 13:26:00 +0100 Subject: [PATCH] Check file exists before trying to take backup --- .../@node-red/runtime/lib/storage/localfilesystem/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/util.js b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/util.js index d07d40868..65a3c40e4 100644 --- a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/util.js +++ b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/util.js @@ -80,7 +80,7 @@ module.exports = { */ writeFile: function(path,content,backupPath) { var backupPromise; - if (backupPath) { + if (backupPath && fs.existsSync(path)) { backupPromise = fs.copy(path,backupPath); } else { backupPromise = Promise.resolve();