summaryrefslogtreecommitdiffstats
path: root/deluge/tests
diff options
context:
space:
mode:
authorDjLegolas <djlegolas@protonmail.com>2022-01-05 02:02:32 +0200
committerCalum Lind <calumlind+deluge@gmail.com>2022-01-06 10:04:19 +0000
commit517b2c653b6fed4b4a9ef5a8e866cc7aa4bd771d (patch)
tree10da8ed4cce669b978ba24350459dfffbbe7dbea /deluge/tests
parent44dcbee5f43b454994b3a6173bdd27802120e707 (diff)
downloaddeluge-517b2c653b6fed4b4a9ef5a8e866cc7aa4bd771d.tar.gz
deluge-517b2c653b6fed4b4a9ef5a8e866cc7aa4bd771d.tar.bz2
deluge-517b2c653b6fed4b4a9ef5a8e866cc7aa4bd771d.zip
[TrackerIcon] Fixed parse error on UTF-8 sites with non-english chars
When parsing the site's page in search for the FAVICON, the page gets opens. The default file encoding in dependent on the running OS, and might not be `UTF-8` on Windows. Therefor, some trackers might not get their icon downloaded at all because of an error: `UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2158: character maps to <undefined>`. This fix adds a detection of file encoding using the optional `chardet` dependency, and also a test. Closes: deluge-torrent/deluge#333 Closes: https://dev.deluge-torrent.org/ticket/3479
Diffstat (limited to 'deluge/tests')
-rw-r--r--deluge/tests/test_tracker_icons.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/deluge/tests/test_tracker_icons.py b/deluge/tests/test_tracker_icons.py
index c8e2f32d9..b7158bc1e 100644
--- a/deluge/tests/test_tracker_icons.py
+++ b/deluge/tests/test_tracker_icons.py
@@ -14,7 +14,6 @@ from . import common
from .basetest import BaseTestCase
common.set_tmp_config_dir()
-deluge.ui.tracker_icons.PIL_INSTALLED = False
common.disable_new_release_check()
@@ -45,6 +44,14 @@ class TrackerIconsTestCase(BaseTestCase):
d.addCallback(self.assertEqual, icon)
return d
+ def test_get_google_ico_hebrew(self):
+ """Test that Google.co.il page is read as UTF-8"""
+ icon = TrackerIcon(common.get_test_data_file('google.ico'))
+ d = self.icons.fetch('www.google.co.il')
+ d.addCallback(self.assertNotIdentical, None)
+ d.addCallback(self.assertEqual, icon)
+ return d
+
def test_get_google_ico_with_redirect(self):
# google.com redirects to www.google.com
icon = TrackerIcon(common.get_test_data_file('google.ico'))