mirror of https://github.com/gorhill/uBlock.git
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);
|
||||
});
|
||||
|
||||
// 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 ) {
|
||||
refs.$re = new RegExp(
|
||||
this.getRegexPattern(idata),
|
||||
filterData[idata+3] === 0 ? '' : 'i'
|
||||
filterData[idata+3] === 0 ? 'i' : ''
|
||||
);
|
||||
}
|
||||
if ( refs.$re.test($requestURLRaw) === false ) { return false; }
|
||||
|
|
Loading…
Reference in New Issue