From 634ecdeb1d3c8c47f22fd0577146cfaa2e737f04 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 19 Nov 2009 04:51:19 +0000 Subject: [PATCH] Fix issues adding magnet uris --- deluge/ui/gtkui/addtorrentdialog.py | 6 +++++- deluge/ui/gtkui/ipcinterface.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index 516796a2a..8f52c362b 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -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 diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py index 046073399..e86c4501a 100644 --- a/deluge/ui/gtkui/ipcinterface.py +++ b/deluge/ui/gtkui/ipcinterface.py @@ -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")