Skip to content

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

Closed

Description

@lainverse

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

Activity

  1. lainverse commented on Apr 6, 2020

    @lainverse
    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?

  2. uBlock-user commented on Apr 6, 2020

    @uBlock-user
    Member

    By-design. You need to add *.

  3. added
    invalid
    on Apr 6, 2020
  4. gorhill commented on Apr 6, 2020

    @gorhill
    Member

    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".

  5. reopened this on Apr 6, 2020
  6. added
    something to address
    and removed
    invalid
    on Apr 6, 2020
  7. added
    enhancement
    and removed
    something to address
    on May 4, 2020
  8. added a commit that references this issue on Jun 14, 2020
  9. ghost closed this as completedon Jun 19, 2020
  10. ghost added
    fixed
    on Jun 19, 2020
  11. szakib commented on Dec 19, 2020

    @szakib

    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.

  12. uBlock-user commented on Dec 19, 2020

    @uBlock-user
    Member

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions