From 4ed72fb3a9cb0e429a35bd582ba38495dc5dc1b4 Mon Sep 17 00:00:00 2001 From: Samuel Progin Date: Sat, 1 Sep 2018 00:00:20 +0200 Subject: [PATCH] backporting UnicodeDecodeError protection Signed-off-by: Samuel Progin --- noisy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/noisy.py b/noisy.py index 341389c..ca4aed0 100644 --- a/noisy.py +++ b/noisy.py @@ -101,7 +101,10 @@ def _is_blacklisted(self, url): :param url: full URL :return: boolean indicating whether a URL is blacklisted or not """ - return any(blacklisted_url in url for blacklisted_url in self._config["blacklisted_urls"]) + try: + return any(blacklisted_url in url for blacklisted_url in self._config["blacklisted_urls"]) + except UnicodeDecodeError: + return True def _should_accept_url(self, url): """