[#2790] Ensure base32 magnet hash is uppercase
This commit is contained in:
parent
f221ae53eb
commit
ad58fca1f9
|
@ -253,7 +253,11 @@ class AddTorrentDialog(component.Component):
|
|||
s = uri.split("&")[0][20:]
|
||||
info_hash = None
|
||||
if len(s) == 32:
|
||||
info_hash = base64.b32decode(s).encode("hex")
|
||||
try:
|
||||
info_hash = base64.b32decode(s.upper()).encode("hex")
|
||||
except TypeError, ex:
|
||||
log.debug("Invalid base32 magnet hash: %s, %s", s, ex)
|
||||
continue
|
||||
elif len(s) == 40:
|
||||
info_hash = s
|
||||
if info_hash is None:
|
||||
|
|
|
@ -732,7 +732,11 @@ class WebApi(JSONComponent):
|
|||
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, ex:
|
||||
log.debug("Invalid base32 magnet hash: %s, %s", xt_hash, ex)
|
||||
break
|
||||
elif len(xt_hash) == 40:
|
||||
info_hash = xt_hash
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue