Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

||*tube.com^ for youtube.com is not working #2663

Closed
gwarser opened this issue May 30, 2017 · 10 comments
Closed

||*tube.com^ for youtube.com is not working #2663

gwarser opened this issue May 30, 2017 · 10 comments

Comments

@gwarser
Copy link
Contributor

gwarser commented May 30, 2017

Filter issues MUST NOT be reported here. Read first: https://github.com/gorhill/uBlock/blob/master/CONTRIBUTING.md

Describe the issue

I want to optimize a bit this filter list https://github.com/azet12/KAD by enclosing domains inside ||...^
to be sure domain filters match inside domain (in ABP - UBO does this by default I think).
Most of combinations works fine:

||*.youtube.com^
||*youtube.com^
||youtube.*^
||youtube.com^

and ||you*.com^!

but not:

||*tube.com^
or
||*ww.youtube.com^

There is no match for youtube.com (www.youtube.com) in UBO. ABP works fine.

Example filter from filter list which I want to convert:

! 55pakiety-lte-5gb.blogspot.com
! 61pakiety-lte-5gb.blogspot.com
! e54pakiety-lte-5gb.blogspot.com
! e51pakiety-lte-5gb.blogspot.com
*pakiety-lte-5gb.blogspot.com

*pakiety-lte-5gb.blogspot.com is working, but I think it may be bit slower in APB (will match in path?) and I want to make these domain filters consistent.
Also, in path part of URL, UBO requires * to match word partially, but not here.

One or more specific URLs where the issue occurs

http://www.spidersweb.pl/2017/05/nvidia-max-q-laptopy.html

Steps for anyone to reproduce the issue

Create filter ||*tube.com^ in my filters
Open http://www.spidersweb.pl/2017/05/nvidia-max-q-laptopy.html
Youtube iframe is not blocked

Your settings

[If you fail to provide this info, I will mark the issue as invalid. Lists all settings which differs from default settings]

  • OS/version: Mint 17.3
  • Browser/version: Fx 55, 1.9.818.50 (Stable channel) (64-bit)
  • uBlock Origin version: 1.12.4, 1.12.5b17
Your filter lists

default

Your custom filters (if any)

||*tube.com^

@lewisje
Copy link

lewisje commented May 30, 2017

I believe that this is intentional; the relevant regexes are .reHostnameRule2 and .reCleanupHostnameRule2, and the cleanup work is done here.

That is, it strips the leading * out of a hostname-anchored rule.

@gwarser
Copy link
Contributor Author

gwarser commented May 30, 2017

These are working:

||you*.com^
||youtube.c*^
*tube.com^

@gorhill
Copy link
Owner

gorhill commented May 30, 2017

That is, it strips the leading * out of a hostname-anchored rule

That would change the meaning of the filter. The expected behavior is that the filter will be instanciated internally as a FilterGenericHnAnchored, however it's being classified as a pure hostname, which is wrong. I am investigating why this happens.

@gorhill
Copy link
Owner

gorhill commented May 30, 2017

Ok so reHostnameRule2 regex /^\**[0-9a-z][0-9a-z.-]*[0-9a-z]\^?$/i is wrong, I can't remember if there was a reason why I crafted it the way it is or whether it's just an oversight.

The ||*tube.com^ case is handled later in the function, but because of the faulty regex, that code path is never reached.

So it looks like it's just an oversight, given that I can't find any such filter in EasyList, EasyPrivacy, RU AdList, EasyList Germany, EasyList China (I stopped looking after this).

@gorhill
Copy link
Owner

gorhill commented May 30, 2017

UBO does this by default I think

Just to be sure there is no misunderstanding, uBO won't automatically anchor with || this if there is at least one asterisk in the filter.

@gwarser
Copy link
Contributor Author

gwarser commented May 30, 2017

given that I can't find any such filter in...

Check in JPN: ABP Japanese filters (日本用フィルタ)

Just to be sure there is no misunderstanding,...

I was thinking about hosts-file-like plain domains.

@gorhill
Copy link
Owner

gorhill commented May 30, 2017

Yes, that list has 2 instances which were improperly categorized by uBO:

||*adexchange.com^$document
||*adexchange.com^$popup

The others ||*... instances were properly categorized because they still did not match reHostnameRule2 because of other stuff in these filters.

@lewisje
Copy link

lewisje commented May 30, 2017

That would change the meaning of the filter.

I agree, but I still thought it was intentional: I remember an earlier case where syntax was re-interpreted in a way that changed the meaning of filters and it was regarded as intentional (I believe it was later changed).

@gwarser
Copy link
Contributor Author

gwarser commented May 30, 2017

@lewisje I was thinking about this, but cannot find this issue. Will be good to create wiki page with quirks like this.

@gorhill
Copy link
Owner

gorhill commented May 30, 2017

Unlike with ABP, tube.com/allo won't match https://youtube.com/allo with uBO, but *tube.com/allo will match with uBO, that is the difference. So given this, ||*tube.com^ should have matched in the current issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants