mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Fix regression causing regex-based filters to be case sensitive
Related feedback:
- https://github.com/AdguardTeam/AdguardFilters/issues/88067#issuecomment-1019518277
Regression commit:
- 725e6931f5
This commit is contained in:
parent
f4824bd0d9
commit
250cf96aae
@ -341,6 +341,31 @@ describe('SNFE', () => {
|
|||||||
});
|
});
|
||||||
assert.strictEqual(r, 0);
|
assert.strictEqual(r, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://github.com/AdguardTeam/AdguardFilters/issues/88067#issuecomment-1019518277
|
||||||
|
it('should match regex-based filter without `match-case` option', async () => {
|
||||||
|
await engine.useLists([
|
||||||
|
{ name: 'test', raw: '/\.com\/[a-z]{9,}\/[a-z]{9,}\.js$/$script,1p' },
|
||||||
|
]);
|
||||||
|
const r = engine.matchRequest({
|
||||||
|
originURL: 'https://example.com/',
|
||||||
|
type: 'script',
|
||||||
|
url: 'https://example.com/LQMDQSMLDAZAEHERE/LQMDQSMLDAZAEHERE.js',
|
||||||
|
});
|
||||||
|
assert.strictEqual(r, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not match regex-based filter with `match-case` option', async () => {
|
||||||
|
await engine.useLists([
|
||||||
|
{ name: 'test', raw: '/\.com\/[a-z]{9,}\/[a-z]{9,}\.js$/$script,1p,match-case' },
|
||||||
|
]);
|
||||||
|
const r = engine.matchRequest({
|
||||||
|
originURL: 'https://example.com/',
|
||||||
|
type: 'script',
|
||||||
|
url: 'https://example.com/LQMDQSMLDAZAEHERE/LQMDQSMLDAZAEHERE.js',
|
||||||
|
});
|
||||||
|
assert.strictEqual(r, 0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ const FilterRegex = class {
|
|||||||
if ( refs.$re === null ) {
|
if ( refs.$re === null ) {
|
||||||
refs.$re = new RegExp(
|
refs.$re = new RegExp(
|
||||||
this.getRegexPattern(idata),
|
this.getRegexPattern(idata),
|
||||||
filterData[idata+3] === 0 ? '' : 'i'
|
filterData[idata+3] === 0 ? 'i' : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( refs.$re.test($requestURLRaw) === false ) { return false; }
|
if ( refs.$re.test($requestURLRaw) === false ) { return false; }
|
||||||
|
Loading…
Reference in New Issue
Block a user