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

Ignore regexp disjunctions in shortcut extraction #3105

Open
3 tasks done
XX-J opened this issue Jan 27, 2025 · 3 comments
Open
3 tasks done

Ignore regexp disjunctions in shortcut extraction #3105

XX-J opened this issue Jan 27, 2025 · 3 comments

Comments

@XX-J
Copy link

XX-J commented Jan 27, 2025

Please answer the following questions for yourself before submitting an issue

  • Filters were updated before reproducing an issue
  • I checked the knowledge base and found no answer
  • I checked to make sure that this issue has not already been filed

AdGuard Extension version

4.4.49

Browser version

FireFox v115.16.1 ESR

OS version

Win7SP1

Ad Blocking

No response

Privacy

No response

Social

No response

Annoyances

No response

Security

No response

Other

No response

Language-specific

No response

What Tracking protection options do you have enabled?

No response

Issue Details

Steps to reproduce:

  1. Insert rule: /(regular|bold)\.woff2$/$domain=adguard.info
  2. Go to https://adguard.info

Expected Behavior

Both, regular.woff2 and bold.woff2 fonts must be blocked.

Actual Behavior

Only first match with rule is blocked.

Screenshots

Screenshot:

Image

Additional Information

If i use rule: /\w{4,7}\.woff2$/$domain=adguard.info, then blocked both fonts.

Screenshot:

Image

@scripthunter7
Copy link
Member

scripthunter7 commented Jan 31, 2025

This issue is related to shortcut extractions. The shortcut should not be extracted from regexp disjunctions. For example, if you change the rule /(regular|bold)\.woff2$/$domain=adguard.info to /(bold|regular)\.woff2$/$domain=adguard.info, the effect remains the same because the shortcut is determined by the length of the strings, not their order. In this case, .woff2 should be extracted as the shortcut, not regular or bold, because .woff2 is the one which always present in all possible matching URLs. Because of this, I will change the issue title.

@scripthunter7 scripthunter7 changed the title Blocking only first match by regexp, if it has | sign Ignore regexp conjunctions in shortcut extraction Jan 31, 2025
@scripthunter7 scripthunter7 changed the title Ignore regexp conjunctions in shortcut extraction Ignore regexp disjunctions in shortcut extraction Jan 31, 2025
@XX-J
Copy link
Author

XX-J commented Feb 1, 2025

...because the shortcut is determined by the length of the strings, not their order.

If use rule /(regular|bold-cyr)\.woff2$/$domain=adguard.info all the same - blocking only first match, though regular string is shorter then bold-cyr.

Screenshot:

Image

Other oddities:

Image

Image

@scripthunter7
Copy link
Member

@XX-J its because -

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

5 participants