diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2022-01-08 18:54:15 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2022-01-08 19:43:40 +0000 |
commit | e50927f5759bc4752baf231ad464f34852587822 (patch) | |
tree | ac3b37f1770595073686b9fec777b1ebb78fe610 /deluge/core/core.py | |
parent | 79b7e6093f42de5a2dbf429f781fd3606a8f9e2e (diff) | |
download | deluge-e50927f5759bc4752baf231ad464f34852587822.tar.gz deluge-e50927f5759bc4752baf231ad464f34852587822.tar.bz2 deluge-e50927f5759bc4752baf231ad464f34852587822.zip |
[GTK] Fix unable to prefetch magnet in thinclient
A UnicodeDecodeError is raised in transfer module when attempting to
prefetch a magnet.
This is result of passing a Python dict containing text bytes and raw
bytes that cannot be decoded as utf-8 in rencode when recieving the
message. This could be handled in rencode by returning raw bytes if
decoding fails (perhaps with a strict mode?) however better to follow
convention of encoding raw bytes in base64 in API calls.
Fixed by retaining bencoding and encoding with base64 when sending
result.
Resolves: https://github.com/deluge-torrent/deluge/pull/334
Diffstat (limited to 'deluge/core/core.py')
-rw-r--r-- | deluge/core/core.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py index 4fa75a414..0563318a5 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -432,12 +432,14 @@ class Core(component.Component): Used by UIs to get magnet files for selection before adding to session. + The metadata is bencoded and for transfer base64 encoded. + Args: magnet (str): The magnet URI. timeout (int): Number of seconds to wait before canceling request. Returns: - Deferred: A tuple of (torrent_id (str), metadata (dict)) for the magnet. + Deferred: A tuple of (torrent_id (str), metadata (str)) for the magnet. """ |