Fixed is_whitelisted_host to use QUrl fixes #4179
This commit is contained in:
parent
770a95c101
commit
3f8958054b
@ -66,10 +66,10 @@ def is_whitelisted_host(url):
|
|||||||
"""Check if the given url is on the adblock whitelist.
|
"""Check if the given url is on the adblock whitelist.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
url: The url to check.
|
url: The url to check in QUrl form.
|
||||||
"""
|
"""
|
||||||
for pattern in config.val.content.host_blocking.whitelist:
|
for pattern in config.val.content.host_blocking.whitelist:
|
||||||
if urlmatch.URLPattern(pattern).matches(url):
|
if urlmatch.UrlPattern(pattern).matches(url):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ class HostBlocker:
|
|||||||
host = url.host()
|
host = url.host()
|
||||||
return ((host in self._blocked_hosts or
|
return ((host in self._blocked_hosts or
|
||||||
host in self._config_blocked_hosts) and
|
host in self._config_blocked_hosts) and
|
||||||
not is_whitelisted_host(url.toString()))
|
not is_whitelisted_host(url))
|
||||||
|
|
||||||
def _read_hosts_file(self, filename, target):
|
def _read_hosts_file(self, filename, target):
|
||||||
"""Read hosts from the given filename.
|
"""Read hosts from the given filename.
|
||||||
|
Loading…
Reference in New Issue
Block a user