diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-01-16 18:36:57 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-01-16 18:36:57 +0100 |
commit | 73f93008f6c8104dcb317b10bae2c6d156674b33 (patch) | |
tree | 37ccbacf5209314a24c85aaaf8cdd1aa81b7b8e2 | |
parent | ce26e394c780260cdb0232e56174c91e71c38770 (diff) | |
download | qutebrowser-73f93008f6c8104dcb317b10bae2c6d156674b33.tar.gz qutebrowser-73f93008f6c8104dcb317b10bae2c6d156674b33.zip |
brave adblocker: Disable on file:/// URLs
Fixes #6000
-rw-r--r-- | qutebrowser/components/braveadblock.py | 6 | ||||
-rw-r--r-- | tests/unit/components/test_braveadblock.py | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py index b00135660..ab8adbdae 100644 --- a/qutebrowser/components/braveadblock.py +++ b/qutebrowser/components/braveadblock.py @@ -141,7 +141,11 @@ class BraveAdBlocker: # use of this adblocking module. return False - if first_party_url is None or not first_party_url.isValid(): + if ( + first_party_url is None + or not first_party_url.isValid() + or first_party_url.scheme() == "file" + ): # FIXME: It seems that when `first_party_url` is None, every URL # I try is blocked. This may have been a result of me incorrectly # using the upstream library, or an upstream bug. For now we don't diff --git a/tests/unit/components/test_braveadblock.py b/tests/unit/components/test_braveadblock.py index eca8b5eb0..d85538807 100644 --- a/tests/unit/components/test_braveadblock.py +++ b/tests/unit/components/test_braveadblock.py @@ -91,6 +91,12 @@ NOT_OKAY_URLS = [ BUGGY_URLS = [ # https://github.com/brave/adblock-rust/issues/146 ("https://example.org/example.png", None, ResourceType.image), + # https://github.com/qutebrowser/qutebrowser/issues/6000 + ( + "https://wikimedia.org/api/rest_v1/media/math/render/svg/57f8", + "file:///home/user/src/qutebrowser/reproc.html", + ResourceType.image, + ), ] |