fix msg property access for CSV legacy mode

This commit is contained in:
Steve-Mcl 2024-04-16 14:28:12 +01:00
parent 407f9e3537
commit 5951632693

View File

@ -153,7 +153,7 @@ module.exports = function(RED) {
var tt = template[t];
if (template[t].indexOf('"') >=0 ) { tt = "'"+tt+"'"; }
else { tt = '"'+tt+'"'; }
var p = RED.util.getMessageProperty(msg, node.property + '["'+s+'"]['+tt+']');
var p = RED.util.getMessageProperty(inputData[s] || {}, tt);
/* istanbul ignore else */
if (p === undefined) { p = ""; }
// fix to honour include null values flag
@ -287,13 +287,13 @@ module.exports = function(RED) {
}
if (node.multi !== "one") {
inputData = a;
RED.util.setMessageProperty(msg, node.propertyOut, a);
if (has_parts && nocr <= 1) {
if (JSON.stringify(o) !== "{}") {
node.store.push(o);
}
if (msg.parts.index + 1 === msg.parts.count) {
inputData = node.store;
RED.util.setMessageProperty(msg, node.propertyOut, node.store);
msg.columns = template.map(v => v.indexOf(',')!==-1 ? '"'+v+'"' : v).filter(v => v).join(',');
delete msg.parts;
send(msg);