]> git.phdru.name Git - extfs.d.git/commitdiff
Feat(torrent): Set default encoding to 'ascii'
authorOleg Broytman <phd@phdru.name>
Sat, 2 Sep 2023 12:16:42 +0000 (15:16 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 2 Sep 2023 12:16:42 +0000 (15:16 +0300)
Some torrent metafiles do not declare encoding/charset.

torrent

diff --git a/torrent b/torrent
index ba725c965aed4ac000d185a2ba481f19066e59b9..bd5ff13f7db394d4b77329a278afed1f2bbd5ccb 100755 (executable)
--- a/torrent
+++ b/torrent
@@ -317,11 +317,11 @@ def decode_torrent():
             encoding = encoding.decode('ascii')
         elif codepage:
             encoding = codepage.decode('ascii')
-
-    if PY3 and encoding:
+        else:
+            encoding = 'ascii'
         return decode_dict(torrent, encoding)
-    else:
-        return torrent
+
+    return torrent
 
 
 def decode_datetime_asc(dt):