make parsing of arguments more robust

This commit is contained in:
Ralf Becker 2014-02-19 15:11:57 +00:00
parent b692346cce
commit d3f2b0a1f9

View File

@ -69,7 +69,12 @@ egw_LAB.wait(function() {
var args = [];
if (matches.length > 1 && matches[2] !== undefined)
{
args = JSON.parse('['+matches[2].replace(/'/g,'"')+']');
try {
args = JSON.parse('['+matches[2]+']');
}
catch(e) { // deal with '-encloded strings (JSON allows only ")
args = JSON.parse('['+matches[2].replace(/','/g, '","').replace(/((^|,)'|'(,|$))/g, '$2"$3')+']');
}
}
args.unshift(matches[1]);
return et2_call.apply(this, args);