From bba3ca8cc0d51446322a98a581821fa0d81c3e75 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 20 Dec 2016 22:46:56 +0000 Subject: [PATCH] Avoid misinterpreting valid objects as encoded arrays in debug --- editor/js/ui/utils.js | 2 +- nodes/core/core/58-debug.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/js/ui/utils.js b/editor/js/ui/utils.js index 8a232f644..d81924b81 100644 --- a/editor/js/ui/utils.js +++ b/editor/js/ui/utils.js @@ -89,7 +89,7 @@ RED.utils = (function() { var isArray = Array.isArray(obj); var isArrayObject = false; - if (obj && typeof obj === 'object' && obj.hasOwnProperty('type') && obj.hasOwnProperty('data')) { + if (obj && typeof obj === 'object' && obj.hasOwnProperty('type') && obj.hasOwnProperty('data') && ((obj.__encoded__ && obj.type === 'array') || obj.type === 'Buffer')) { isArray = true; isArrayObject = true; } diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index e16f710b5..8b1c5a2bb 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -118,6 +118,7 @@ module.exports = function(RED) { } if (util.isArray(value) && value.length > debuglength) { value = { + __encoded__: true, type: "array", data: value.slice(0,debuglength), length: value.length