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

static syntax inconsistency #2899

Closed
joey04 opened this issue Aug 25, 2017 · 5 comments
Closed

static syntax inconsistency #2899

joey04 opened this issue Aug 25, 2017 · 5 comments

Comments

@joey04
Copy link

joey04 commented Aug 25, 2017

using 1.13.8 with Fanboy Ultimate on Pale Moon 27.4

This rule works on this IMDb page:
/wrap$image,domain=imdb.com

But this rule does not work on this TVguide page:
/thumb$image,important,domain=tvguide.com
Instead, I had to expand it. Now this works:
||tvgcdn.net^*/thumb$image,important,domain=tvguide.com

(Note that $important needed to override an EasyList allow for tvguide.com. It's still the same problem without it.)

This appears to be a bug of syntax parsing inconsistency.

@gwarser
Copy link
Contributor

gwarser commented Aug 25, 2017

I don't see "wrap" on IMDB page, but on TVguide "/thumb" is realy "/thumbs" and uBlock assumes word boundary for this type of filters. Use "/thumb*" or "/thumbs".

#1065

@gorhill
Copy link
Owner

gorhill commented Aug 25, 2017

By design as pointed out by @gwarser. Use asterisk if you want /thumb to match /thumbs. Best is of course to use /thumbs/* because the no regex will be used internally, just plain string comparison.

(I also don't see any instances of /wrap on IMDB).

@gorhill gorhill closed this as completed Aug 25, 2017
@joey04
Copy link
Author

joey04 commented Aug 25, 2017

/wrap is there in the link I provided:

untitled

Okay, so it's a matter of word boundary and need for *. That's what I needed to know. (BTW, /thumb* is useful for at least 2 different patterns on various pages of tvguide.com which is why I did it that way.)

And let me echo what lewisje requested in #1065 - please add important details like this to the wiki page. (Likewise, please do the same for the my comment last week for the Logger wiki page.)

@joey04
Copy link
Author

joey04 commented Aug 26, 2017

Best is of course to use /thumbs/* because the no regex will be used internally, just plain string comparison.

Does /foo/$domain=bar ensure plain string comparison?

This would mean for my 2 rules in this thread:

  1. /thumb/ instead of /thumb* to match "thumbs" and "thumbnail"

  2. /wrap/ instead of /wrap for screenshot in my prior post

@joey04
Copy link
Author

joey04 commented Aug 26, 2017

Thankfully I've now learned enough that I can answer my own question -- No, /foo/ results in a regular expression. (I got the idea a little while ago to view the sqlite contents to see the compiled values.)

The * at the end makes a big difference, resulting in a plain string comparison, as gorhill mentioned. Thus /foo/* is the way to go. This makes sense, since there are a bunch of rules like that in EasyList already.

So I've come full circle with my 2 rules being what I posted originally. (Minor change is adding a dash for /wrap- to be a bit more honed in.) I could use /thumb*... for tvguide but kept the tvgcdn-prefixed one because they're all hosted there (which is what the logger rule wizard would suggest as well).

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

No branches or pull requests

3 participants