From cd6669c024518a33c4ac88cd9b8594c70d570df1 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 10 Apr 2016 19:53:16 +0100 Subject: [PATCH] [#2790] Ensure base32 magnet hash is uppercase --- deluge/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/common.py b/deluge/common.py index 400f0ec98..276e86a2d 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -612,7 +612,11 @@ def get_magnet_info(uri): if param.startswith(xt_param): xt_hash = param[len(xt_param):] if len(xt_hash) == 32: - info_hash = base64.b32decode(xt_hash).encode("hex") + try: + info_hash = base64.b32decode(xt_hash.upper()).encode("hex") + except TypeError as ex: + log.debug("Invalid base32 magnet hash: %s, %s", xt_hash, ex) + break elif len(xt_hash) == 40: info_hash = xt_hash else: