make sure queries that both start and end with '*' are not interpreted as starts/ends with

This commit is contained in:
rlx 2013-08-26 17:09:50 +00:00
parent 0378c58d26
commit ed127b0259

View file

@ -627,14 +627,11 @@ Ox.URL = function(options) {
// missing operator or unknown key // missing operator or unknown key
condition = {key: '*', value: str, operator: '='}; condition = {key: '*', value: str, operator: '='};
} }
if ( if (['=', '!='].indexOf(condition.operator) > -1) {
['=', '!='].indexOf(condition.operator) > -1 if (Ox.startsWith(condition.value, '*') && !Ox.endsWith(condition.value, '*')) {
&& condition.value != '*'
) {
if (condition.value[0] == '*') {
condition.value = condition.value.slice(1); condition.value = condition.value.slice(1);
condition.operator = condition.operator.replace('=', '$') 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.value = condition.value.slice(0, -1);
condition.operator = condition.operator.replace('=', '^') condition.operator = condition.operator.replace('=', '^')
} }