mirror of https://github.com/gorhill/uBlock.git
Do not assume wildcards fall on label boundaries
Related commit:
- fe0b7a0e0f
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/572#issuecomment-492223980
This commit is contained in:
parent
93f80eedfa
commit
a14dcecf8f
|
@ -305,11 +305,14 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
|
|||
// https://github.com/uBlockOrigin/uBlock-issues/issues/572
|
||||
// Extract best possible hostname.
|
||||
let deshn = des;
|
||||
const pos = deshn.lastIndexOf('*');
|
||||
let pos = deshn.lastIndexOf('*');
|
||||
if ( pos !== -1 ) {
|
||||
deshn = deshn.slice(pos + 1);
|
||||
if ( deshn.charCodeAt(0) === 0x2E /* '.' */ ) {
|
||||
deshn = deshn.replace(/\.+/, '');
|
||||
pos = deshn.indexOf('.');
|
||||
if ( pos !== -1 ) {
|
||||
deshn = deshn.slice(pos + 1);
|
||||
} else {
|
||||
deshn = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,7 +337,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
|
|||
srchns = option.slice(7).split('|');
|
||||
continue;
|
||||
}
|
||||
if ( option === 'first-party' || option === '1p' ) {
|
||||
if ( (option === 'first-party' || option === '1p') && deshn !== '' ) {
|
||||
srchns.push(µBlock.URI.domainFromHostname(deshn) || deshn);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue