Fix for ampersand on values (JS only)

This commit is contained in:
David Manzanares 2017-10-20 12:45:03 +02:00
parent bf4c67034a
commit 3596991362

View File

@ -93,9 +93,9 @@ tree.Filterset.prototype.toJS = function(env) {
} }
var attrs = "data"; var attrs = "data";
if (op === '=~') { if (op === '=~') {
return "(" + attrs + "['" + filter.key.value + "'] + '').match(" + (val.is === 'string' ? "'" + val.toString().replace(/'/g, "\\'") + "'" : val) + ")"; return "(" + attrs + "['" + filter.key.value + "'] + '').match(" + (val.is === 'string' ? "'" + val.toString().replace(/'/g, "\\'").replace(/&/g, '&') + "'" : val) + ")";
} }
return attrs + "['" + filter.key.value + "'] " + op + " " + (val.is === 'string' ? "'" + val.toString().replace(/'/g, "\\'") + "'" : val); return attrs + "['" + filter.key.value + "'] " + op + " " + (val.is === 'string' ? "'" + val.toString().replace(/'/g, "\\'").replace(/&/g, '&') + "'" : val);
}).join(' && '); }).join(' && ');
}; };