From 34f81634e5f0f91643f205d175c5ff8831c405ea Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 16 Jun 2011 02:57:20 +0100 Subject: [PATCH] Fix path error with torrent files prefixed with 'file://' from Firefox --- deluge/ui/gtkui/ipcinterface.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py index dc2f917ea..57afd2427 100644 --- a/deluge/ui/gtkui/ipcinterface.py +++ b/deluge/ui/gtkui/ipcinterface.py @@ -90,7 +90,7 @@ class IPCInterface(component.Component): for arg in args: if arg.strip(): if not deluge.common.is_magnet(arg) and not deluge.common.is_url(arg): - arg = os.path.abspath(arg) + arg = os.path.abspath(arg.replace('file://', '', 1)) _args.append(arg) args = _args @@ -218,11 +218,9 @@ def process_args(args): client.core.add_torrent_magnet(arg, {}) else: # Just a file - log.debug("Attempting to add %s from external source..", - os.path.abspath(arg)) + log.debug("Attempting to add %s from external source..", arg) if config["interactive_add"]: - component.get("AddTorrentDialog").add_from_files([os.path.abspath(arg)]) + component.get("AddTorrentDialog").add_from_files([arg]) component.get("AddTorrentDialog").show(config["focus_add_dialog"]) else: - path = os.path.abspath(arg) - client.core.add_torrent_file(os.path.split(path)[-1], base64.encodestring(open(path, "rb").read()), None) + client.core.add_torrent_file(os.path.split(arg)[-1], base64.encodestring(open(arg, "rb").read()), None)