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

queryprune incorrectly handles (removes) "hash" part of the URL #1415

Closed
7 of 8 tasks
gwarser opened this issue Dec 23, 2020 · 0 comments
Closed
7 of 8 tasks

queryprune incorrectly handles (removes) "hash" part of the URL #1415

gwarser opened this issue Dec 23, 2020 · 0 comments
Labels
bug Something isn't working fixed issue has been addressed

Comments

@gwarser
Copy link

gwarser commented Dec 23, 2020

Details

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

Clicking link to wiki in my message on Reddit causes wiki to open on top instead of scrolled to "YouTube"/#wiki_youtube section.

This happens because Reddit adds utm_* parameters and I have filter for them:

utm_$queryprune=/^utm_/

Basically if last parameter is removed - hash part is also removed.

This happens because uBO is splitting URL on ? and ignores that hash part is kept in second part of URL and then when last parameter is removed, hash is also removed, because uBO sees it as part of last parameter value. (gibberish? # is passed to URLSearchParams and this function does not understand its special meaning)

There are also two other issues:

When last parameter is not removed, # character is percent-encoded to %23:

http://example.com/?utm_asdf=2&foo=bar#baz -> http://example.com/?foo=bar%23baz

When last parameter does not have a value, = character is appended:

http://example.com/?utm_asdf=2&foo#bar -> http://example.com/?foo#bar=

A specific URL where the issue occurs

https://old.reddit.com/r/firefox/comments/khis7a/is_there_any_addon_that_blocks_these_annoying/ggmlioc/

Steps to Reproduce

  1. enable filterAuthorMode
  2. add utm_$queryprune=/^utm_/
  3. open https://old.reddit.com/r/firefox/comments/khis7a/is_there_any_addon_that_blocks_these_annoying/ggmlioc/
  4. click the link in the message

Expected behavior:

Wiki scrolled to "YouTube" section.

Actual behavior:

Wiki on top.

Your environment

  • uBlock Origin version: 1.32.1b0
  • Browser Name and version: Firefox Nightly
  • Operating System and version: Manjaro KDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

2 participants