Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix torrent hash from magnet to be unicode #8563

Merged
merged 2 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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