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,8 +10,13 @@ export default function validateWidgetData(widget, endpoint, data) {
try {
dataParsed = JSON.parse(data);
} catch (e) {
error = e;
valid = false;
try {
// try once more stripping whitespace
dataParsed = JSON.parse(data.toString().replace(/\s/g, ""));
} catch (e2) {
error = e || e2;
valid = false;
}
}
}

Loading…
Cancel
Save