mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Fixed better handling of odd quotes in CSV node
(and a better commit message)
This commit is contained in:
		@@ -132,7 +132,7 @@ module.exports = function(RED) {
 | 
			
		||||
                                    if (line[i-1] === node.quo) { k[j] += '\"'; } // if it's a quotequote then it's actually a quote
 | 
			
		||||
                                    //if ((line[i-1] !== node.sep) && (line[i+1] !== node.sep)) { k[j] += line[i]; }
 | 
			
		||||
                                }
 | 
			
		||||
                                else if ((line[i] === node.sep)) { // if it is the end of the line then finish
 | 
			
		||||
                                else if ((line[i] === node.sep) && f) { // if it is the end of the line then finish
 | 
			
		||||
                                    if (!node.goodtmpl) { node.template[j] = "col"+(j+1); }
 | 
			
		||||
                                    if ( node.template[j] && (node.template[j] !== "") && (k[j] !== "" ) ) {
 | 
			
		||||
                                        if ( reg.test(k[j]) ) { k[j] = parseFloat(k[j]); }
 | 
			
		||||
@@ -140,9 +140,8 @@ module.exports = function(RED) {
 | 
			
		||||
                                    }
 | 
			
		||||
                                    j += 1;
 | 
			
		||||
                                    k[j] = "";
 | 
			
		||||
                                    f = true; // reset in/out flag ready for next line.
 | 
			
		||||
                                }
 | 
			
		||||
                                else if (f && ((line[i] === "\n") || (line[i] === "\r"))) { // handle multiple lines
 | 
			
		||||
                                else if ((line[i] === "\n") || (line[i] === "\r")) { // handle multiple lines
 | 
			
		||||
                                    //console.log(j,k,o,k[j]);
 | 
			
		||||
                                    if (!node.goodtmpl) { node.template[j] = "col"+(j+1); }
 | 
			
		||||
                                    if ( node.template[j] && (node.template[j] !== "") && (k[j] !== "") ) {
 | 
			
		||||
@@ -161,6 +160,7 @@ module.exports = function(RED) {
 | 
			
		||||
                                    j = 0;
 | 
			
		||||
                                    k = [""];
 | 
			
		||||
                                    o = {};
 | 
			
		||||
                                    f = true; // reset in/out flag ready for next line.
 | 
			
		||||
                                }
 | 
			
		||||
                                else { // just add to the part of the message
 | 
			
		||||
                                    k[j] += line[i];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user