From ed127b02592b4e46d6f4c09ff2568caa9cae2926 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 26 Aug 2013 17:09:50 +0000 Subject: [PATCH] make sure queries that both start and end with '*' are not interpreted as starts/ends with --- source/Ox.UI/js/Core/URL.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Core/URL.js b/source/Ox.UI/js/Core/URL.js index f1ba9b7d..b59b88a2 100644 --- a/source/Ox.UI/js/Core/URL.js +++ b/source/Ox.UI/js/Core/URL.js @@ -627,14 +627,11 @@ Ox.URL = function(options) { // missing operator or unknown key condition = {key: '*', value: str, operator: '='}; } - if ( - ['=', '!='].indexOf(condition.operator) > -1 - && condition.value != '*' - ) { - if (condition.value[0] == '*') { + if (['=', '!='].indexOf(condition.operator) > -1) { + if (Ox.startsWith(condition.value, '*') && !Ox.endsWith(condition.value, '*')) { condition.value = condition.value.slice(1); condition.operator = condition.operator.replace('=', '$') - } else if (condition.value[condition.value.length - 1] == '*') { + } else if (Ox.endsWith(condition.value, '*') && !Ox.startsWith(condition.value, '*')) { condition.value = condition.value.slice(0, -1); condition.operator = condition.operator.replace('=', '^') }