Skip to content

Commit

Permalink
Fix torrent hash from magnet to be unicode (#8563)
Browse files Browse the repository at this point in the history
* fix torrent hash from magnet to be unicode

* update changelog
  • Loading branch information
sharkykh authored Oct 2, 2020
1 parent 547b41f commit 3821bbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fix notify lists for prowl and email ([8535](https://github.com/pymedusa/Medusa/pull/8535))
- Fix shows sorting by article sort using (the, a, an) was reversed in config-general ([8532](https://github.com/pymedusa/Medusa/pull/8532))
- Fix sending torrents to qBittorrent api version > 2.0.0 ([8528](https://github.com/pymedusa/Medusa/pull/8528))
- Fix decoding torrent hash from magnet links ([8563](https://github.com/pymedusa/Medusa/pull/8563))

-----

Expand Down
3 changes: 2 additions & 1 deletion medusa/clients/torrent/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def _get_info_hash(result):
if result.url.startswith('magnet:'):
result.hash = re.findall(r'urn:btih:([\w]{32,40})', result.url)[0]
if len(result.hash) == 32:
result.hash = b16encode(b32decode(result.hash)).lower()
hash_b16 = b16encode(b32decode(result.hash)).lower()
result.hash = hash_b16.decode('utf-8')
else:

try:
Expand Down

0 comments on commit 3821bbc

Please sign in to comment.