[#2790] Ensure base32 magnet hash is uppercase

This commit is contained in:
Calum Lind 2016-04-10 19:53:16 +01:00
parent 5c69b56cd5
commit cd6669c024

View File

@ -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: