mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 00:20:37 +01:00
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 <mike@brickfieldlabs.ie>
This commit is contained in:
parent
8de12b7997
commit
0a86c6a123
2
lib/amd/build/templates.min.js
vendored
2
lib/amd/build/templates.min.js
vendored
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user