1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix: Allow CR and LF control chars to be a part of the value (#2526)

To properly parse CSV data.
This commit is contained in:
tmdoit 2020-04-03 16:10:33 +02:00 committed by GitHub
parent 344c9fe57e
commit 4f31632863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,7 +187,7 @@ module.exports = function(RED) {
// if separator is last char in processing string line (without end of line), add null value at the end - example: '1,2,3\n3,"3",' // if separator is last char in processing string line (without end of line), add null value at the end - example: '1,2,3\n3,"3",'
k[j] = line.length - 1 === i ? null : ""; k[j] = line.length - 1 === i ? null : "";
} }
else if ((line[i] === "\n") || (line[i] === "\r")) { // handle multiple lines else if (((line[i] === "\n") || (line[i] === "\r")) && f) { // handle multiple lines
//console.log(j,k,o,k[j]); //console.log(j,k,o,k[j]);
if (!node.goodtmpl) { node.template[j] = "col"+(j+1); } if (!node.goodtmpl) { node.template[j] = "col"+(j+1); }
if ( node.template[j] && (node.template[j] !== "") ) { if ( node.template[j] && (node.template[j] !== "") ) {