Enhancement: strip whitespace when checking JSON (#3706)

pull/3711/head
shamoon 4 months ago committed by GitHub
parent 231e2408c3
commit 38c32233f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -10,10 +10,15 @@ export default function validateWidgetData(widget, endpoint, data) {
try {
dataParsed = JSON.parse(data);
} catch (e) {
error = e;
try {
// try once more stripping whitespace
dataParsed = JSON.parse(data.toString().replace(/\s/g, ""));
} catch (e2) {
error = e || e2;
valid = false;
}
}
}
if (dataParsed && Object.entries(dataParsed).length) {
const mappings = widgets[widget.type]?.mappings;

Loading…
Cancel
Save