From 30b8a9542165840cf9280b3d5a4fe5beedda6a8b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 1 Jul 2022 17:34:16 +0100 Subject: [PATCH 1/2] Do not remove unknown credentials of Subflow Modules Fixes #3641 --- .../@node-red/runtime/lib/flows/Subflow.js | 1 - .../@node-red/runtime/lib/nodes/credentials.js | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/flows/Subflow.js b/packages/node_modules/@node-red/runtime/lib/flows/Subflow.js index 2e2beed74..824b88a28 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/Subflow.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/Subflow.js @@ -390,7 +390,6 @@ class Subflow extends Flow { } name = newName; } - var parent = this.parent; if (parent) { diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js index 0432e01fb..5a72ab7fc 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js @@ -373,11 +373,14 @@ var api = module.exports = { } } - for (cred in savedCredentials) { - if (savedCredentials.hasOwnProperty(cred)) { - if (!newCreds.hasOwnProperty(cred)) { - delete savedCredentials[cred]; - dirty = true; + if (/^subflow(:|$)/.test(nodeType)) { + for (cred in savedCredentials) { + if (savedCredentials.hasOwnProperty(cred)) { + if (!newCreds.hasOwnProperty(cred)) { + console.log(` + ${cred} deleting for some reason`) + delete savedCredentials[cred]; + dirty = true; + } } } } From 6c797e35cf0c9ee585c20903c367d2aa1435b688 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 4 Jul 2022 20:21:25 +0100 Subject: [PATCH 2/2] Update packages/node_modules/@node-red/runtime/lib/nodes/credentials.js --- packages/node_modules/@node-red/runtime/lib/nodes/credentials.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js index 5a72ab7fc..305594c85 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js @@ -377,7 +377,6 @@ var api = module.exports = { for (cred in savedCredentials) { if (savedCredentials.hasOwnProperty(cred)) { if (!newCreds.hasOwnProperty(cred)) { - console.log(` + ${cred} deleting for some reason`) delete savedCredentials[cred]; dirty = true; }