fix #227 (the fork bomb bug)

This commit is contained in:
rlx 2012-02-19 15:38:08 +00:00
parent 6a9707ed0b
commit b9a86e2620

View file

@ -367,7 +367,7 @@ Ox.URL = function(options) {
} }
function parseFind(str) { function parseFind(str) {
str = str.replace(/%7C/g, '|'); str = (str || '').replace(/%7C/g, '|');
var conditions, counter = 0, var conditions, counter = 0,
find = {conditions: [], operator: '&'}, find = {conditions: [], operator: '&'},
subconditions = []; subconditions = [];
@ -385,6 +385,10 @@ Ox.URL = function(options) {
(++counter == 1) && subconditions.push(''); (++counter == 1) && subconditions.push('');
} }
}); });
subconditions = subconditions.filter(function(subcondition) {
// make sure empty brackets don't throw errors
return !!subcondition;
});
subconditions.forEach(function(subcondition, i) { subconditions.forEach(function(subcondition, i) {
str = str.replace(subcondition, i); str = str.replace(subcondition, i);
}); });