From 35969913620c47f5dcedff1293ac124d9fa9f6e3 Mon Sep 17 00:00:00 2001 From: David Manzanares Date: Fri, 20 Oct 2017 12:45:03 +0200 Subject: [PATCH] Fix for ampersand on values (JS only) --- lib/carto/tree/filterset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/carto/tree/filterset.js b/lib/carto/tree/filterset.js index 2866959..4fa569f 100644 --- a/lib/carto/tree/filterset.js +++ b/lib/carto/tree/filterset.js @@ -93,9 +93,9 @@ tree.Filterset.prototype.toJS = function(env) { } var attrs = "data"; 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(' && '); };