Fix issues adding magnet uris

This commit is contained in:
Andrew Resch 2009-11-19 04:51:19 +00:00
parent aa86aa6fe1
commit 634ecdeb1d
2 changed files with 8 additions and 2 deletions

View File

@ -226,7 +226,11 @@ class AddTorrentDialog(component.Component):
new_row = None
for uri in uris:
info_hash = base64.b32decode(uri.split("&")[0][20:]).encode("hex")
s = uri.split("&")[0][20:]
if len(s) == 32:
info_hash = base64.b32decode(s).encode("hex")
elif len(s) == 40:
info_hash = s
if info_hash in self.infos:
log.debug("Torrent already in list!")
continue

View File

@ -71,7 +71,9 @@ class IPCInterface(component.Component):
_args = []
for arg in args:
if arg.strip():
_args.append(os.path.abspath(arg))
if not deluge.common.is_magnet(arg) and not deluge.common.is_url(arg):
arg = os.path.abspath(arg)
_args.append(arg)
args = _args
socket = os.path.join(deluge.configmanager.get_config_dir("ipc"), "deluge-gtk")