From f6901cd19f774d26cb3ad7187302e4acce304a31 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 19 Dec 2022 09:50:29 +0000 Subject: [PATCH 1/3] CSV node replace replace with replaceAll just in case mentioned in Issue #3989 --- packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js b/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js index 9c55fa2b6..504e184d2 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js @@ -19,9 +19,9 @@ module.exports = function(RED) { function CSVNode(n) { RED.nodes.createNode(this,n); this.template = (n.temp || ""); - this.sep = (n.sep || ',').replace("\\t","\t").replace("\\n","\n").replace("\\r","\r"); + this.sep = (n.sep || ',').replaceAll("\\t","\t").replaceAll("\\n","\n").replaceAll("\\r","\r"); this.quo = '"'; - this.ret = (n.ret || "\n").replace("\\n","\n").replace("\\r","\r"); + this.ret = (n.ret || "\n").replaceAll("\\n","\n").replaceAll("\\r","\r"); this.winflag = (this.ret === "\r\n"); this.lineend = "\n"; this.multi = n.multi || "one"; From 24291918386c9fbef309a6ff8caeffb99ecb6ec8 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 19 Dec 2022 13:48:21 +0000 Subject: [PATCH 2/3] CSV - swap to regex replace for node14 support --- packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js b/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js index 504e184d2..04f2bb71f 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-CSV.js @@ -19,9 +19,9 @@ module.exports = function(RED) { function CSVNode(n) { RED.nodes.createNode(this,n); this.template = (n.temp || ""); - this.sep = (n.sep || ',').replaceAll("\\t","\t").replaceAll("\\n","\n").replaceAll("\\r","\r"); + this.sep = (n.sep || ',').replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/\\r/g,"\r"); this.quo = '"'; - this.ret = (n.ret || "\n").replaceAll("\\n","\n").replaceAll("\\r","\r"); + this.ret = (n.ret || "\n").replace(/\\n/g,"\n").replace(/\\r/g,"\r"); this.winflag = (this.ret === "\r\n"); this.lineend = "\n"; this.multi = n.multi || "one"; From 93a191123210251b104adac35d1ec38c5aab941a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 19 Dec 2022 21:26:20 +0000 Subject: [PATCH 3/3] CSV - Add note about msg.reset to info page to close #3976 --- .../@node-red/nodes/locales/en-US/parsers/70-CSV.html | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/parsers/70-CSV.html b/packages/node_modules/@node-red/nodes/locales/en-US/parsers/70-CSV.html index dc4dd98ff..baa3b036b 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/parsers/70-CSV.html +++ b/packages/node_modules/@node-red/nodes/locales/en-US/parsers/70-CSV.html @@ -47,5 +47,6 @@

If 'include null values' option is checked, null values will be returned in result, ie. middle value '"1",,3'.

The node can accept a multi-part input as long as the parts property is set correctly, for example from a file-in node or split node.

If outputting multiple messages they will have their parts property set and form a complete message sequence.

+

If the node is set to only send column headers once, then setting msg.reset to any value will cause the node to resend the headers.

Note: the column template must be comma separated - even if a different separator is chosen for the data.