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

redirect-rule doesn't work when blank pattern (asterisk) is omitted #977

Closed
8 tasks done
lainverse opened this issue Apr 6, 2020 · 5 comments
Closed
8 tasks done
Labels
enhancement New feature or request fixed issue has been addressed

Comments

@lainverse
Copy link

lainverse commented Apr 6, 2020

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

According to logger blocked URLs are not redirected in case redirect rule with blank pattern is present, but starts with $ instead of *$. Normal blocking rules with omitted blank pattern work fine since asterisk is optional in such case. Not for redirect rules, though.

A specific URL where the issue occurs

https://www.reddit.com/

Steps to Reproduce

  1. Add following two rules:
    $script,redirect-rule=noopjs,domain=reddit.com
    $script,domain=reddit.com
  2. Open logger and filter it by 'noop'
  3. Visit reddit.com anc check logger.
  4. Change first rule to:
    *$script,redirect-rule=noopjs,domain=reddit.com
    Note extra asterisk at start.
  5. Repeat 3.

Expected behavior:

In both cases all blocked scripts redirected to noop.js and that is visible in the log.

Actual behavior:

Only in second case (step 5) blocked scripts are redirected to noop.js and appear in the log.

Your environment

  • uBlock Origin version: 1.25.2
  • Browser Name and version: Firefox 75.0b12 (64-bit)
  • Operating System and version: Windows 10 18363.752
@lainverse
Copy link
Author

Ugh, looks like missed this in the documentation. It were mentioned for normal redirect instead of redirect-rule. Not sure why is it like this, though. Why is it not optional?

@uBlock-user
Copy link
Contributor

By-design. You need to add *.

@uBlock-user uBlock-user added the invalid not a uBlock issue label Apr 6, 2020
@gorhill
Copy link
Member

gorhill commented Apr 6, 2020

Why is it not optional?

Just the way the feature evolved over time. I can internally map the empty pattern to * if that is convenient. I just wished that * had be the canonical way to specify "match any URL".

@gorhill gorhill reopened this Apr 6, 2020
@uBlock-user uBlock-user added something to address something to address and removed invalid not a uBlock issue labels Apr 6, 2020
@uBlock-user uBlock-user added enhancement New feature or request and removed something to address something to address labels May 4, 2020
gorhill added a commit to gorhill/uBlock that referenced this issue Jun 14, 2020
Related issue:
- uBlockOrigin/uBlock-issues#977

No pattern will imply `*` for the redirect destination
part of the rule.
@gwarser gwarser closed this as completed Jun 19, 2020
@gwarser gwarser added the fixed issue has been addressed label Jun 19, 2020
@szakib
Copy link

szakib commented Dec 19, 2020

By-design. You need to add *.

Please add this fact to the documentation. This GitHub page is the only place where this fact is written down.

@uBlock-user
Copy link
Contributor

@szakib That's no longer necessary - gorhill/uBlock@cb5437b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

5 participants