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

Fix join to not crash on appending invalid tyoes to buffer.

Add extra info to clarify use of complete
to Close #2505
This commit is contained in:
Dave Conway-Jones 2020-03-15 16:43:32 +00:00
parent 43258ee816
commit 85a1f59a93
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
3 changed files with 13 additions and 5 deletions

View File

@ -630,8 +630,14 @@ module.exports = function(RED) {
var group = inflight[partId];
if (payloadType === 'buffer') {
if (property !== undefined) {
if (Buffer.isBuffer(property) || (typeof property === "string") || Array.isArray(property)) {
inflight[partId].bufferLen += property.length;
}
else {
node.error(RED._("join.errors.invalid-type",{error:(typeof property)}),msg);
return;
}
}
}
if (payloadType === 'object') {
group.payload[propertyKey] = property;

View File

@ -894,7 +894,8 @@
"fixup": "Fix-up exp"
},
"errors": {
"invalid-expr": "Invalid JSONata expression: __error__"
"invalid-expr": "Invalid JSONata expression: __error__",
"invalid-type": "Cannot join __error__ to buffer"
}
},
"sort" : {

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<script type="text/x-red" data-help-name="split">
<script type="text/html" data-help-name="split">
<p>Splits a message into a sequence of messages.</p>
<h3>Inputs</h3>
@ -63,7 +63,7 @@
means it cannot be used with the <b>join</b> node in its automatic mode</p>
</script>
<script type="text/x-red" data-help-name="join">
<script type="text/html" data-help-name="join">
<p>Joins sequences of messages into a single message.</p>
<p>There are three modes available:</p>
<dl>
@ -91,7 +91,8 @@
</ul>
</dd>
<dt class="optional">complete</dt>
<dd>If set, the node will send its output message in its current state.</dd>
<dd>If set, the node will append the payload, and then send the output message in its current state.
If you don't wish to append the payload, delete it from the msg.</dd>
</dl>
<h3>Details</h3>