MDL-77003 javascript: improve string helper JSON detection.
Changes in fbc2732d made the JS template string helper method
too strict in regards to what it considers a valid JSON object.
Co-authored-by: Mike Churchward <[email protected]>
This commit is contained in:
co-authored by
Mike Churchward
parent
8de12b7997
commit
0a86c6a123
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -558,8 +558,7 @@ function(
|
||||
}
|
||||
|
||||
// Allow json formatted $a arguments.
|
||||
// Added double quote after left curly bracket to differentiate between string and JSON string.
|
||||
if (param.indexOf('{"') === 0) {
|
||||
if (param.match(/^{\s*"/gm)) {
|
||||
// If it can't be parsed then the string is not a JSON format.
|
||||
try {
|
||||
const parsedParam = JSON.parse(param);
|
||||
|
||||
Reference in New Issue
Block a user