Merge pull request #45 from CartoDB/ampersand-fix

Fix for ampersand on values (JS only)
This commit is contained in:
David M 2017-10-20 15:08:27 +02:00 committed by GitHub
commit 4dfe5361b3

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(' && ');
}; };