Fix data buffer parsing error

pull/1334/head
shamoon 2 years ago
parent cd95c93e68
commit 4824ed1a2c

@ -2,10 +2,8 @@ import widgets from "widgets/widgets";
export default function validateWidgetData(widget, endpoint, data) { export default function validateWidgetData(widget, endpoint, data) {
let valid = true; let valid = true;
let dataParsed; let dataParsed = data;
if (typeof data === 'object') { if (Buffer.isBuffer(data)) {
dataParsed = data;
} else {
try { try {
dataParsed = JSON.parse(data); dataParsed = JSON.parse(data);
} catch (e) { } catch (e) {

Loading…
Cancel
Save