From 193e420eb3bd308fd2acf085125620ef7d2ec88b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 2 May 2022 20:11:04 +0100 Subject: [PATCH] Fix Watch node handling of recursive directories Fixes #3566 --- .../@node-red/nodes/core/storage/23-watch.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/storage/23-watch.js b/packages/node_modules/@node-red/nodes/core/storage/23-watch.js index 4a1be0ec7..ccbdeba9f 100644 --- a/packages/node_modules/@node-red/nodes/core/storage/23-watch.js +++ b/packages/node_modules/@node-red/nodes/core/storage/23-watch.js @@ -31,7 +31,7 @@ module.exports = function(RED) { this.p = (this.files.length === 1) ? this.files[0] : JSON.stringify(this.files); const node = this; - const watcher = watch(this.files, { recursive: true }); + const watcher = watch(this.files, { recursive: this.recursive }); watcher.on('change', function (event, fpath) { const file = path.basename(fpath) @@ -53,13 +53,7 @@ module.exports = function(RED) { else if (stat.isCharacterDevice()) { type = "characterdevice"; } else if (stat.isSocket()) { type = "socket"; } else if (stat.isFIFO()) { type = "fifo"; } - else if (stat.isDirectory()) { - type = "directory"; - if (node.recursive) { - notifications.add([fpath]); - notifications.add(getAllDirs(fpath)); - } - } + else if (stat.isDirectory()) { type = "directory"; } else { type = "n/a"; } } msg.type = type;