From 90a143a4efba7ee26b8716aeb053d2e32316e29e Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 19 Nov 2009 02:39:07 +0000 Subject: [PATCH] Fix issue where some torrents with special characters could not be added --- ChangeLog | 1 + deluge/ui/gtkui/addtorrentdialog.py | 26 ++++++-------------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 267deb999..38544b39a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ * Fix autoconnecting to the next host in the list if the selected one isn't available * Fix endless loop when trying to autoconnect to an offline daemon * Fix exception on startup when the system tray icon is not enabled + * Fix issue where some torrents with special characters could not be added ==== Web ==== * Fix installing the deluge-web manpage diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index a9de36a2e..516796a2a 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -716,11 +716,6 @@ class AddTorrentDialog(component.Component): if row is not None: self.save_torrent_options(row) - torrent_filenames = [] - torrent_magnets = [] - torrent_magnet_options = [] - torrent_options = [] - row = self.torrent_liststore.get_iter_first() while row != None: torrent_id = self.torrent_liststore.get_value(row, 0) @@ -735,26 +730,17 @@ class AddTorrentDialog(component.Component): options["file_priorities"] = file_priorities if deluge.common.is_magnet(filename): - torrent_magnets.append(filename) del options["file_priorities"] - torrent_magnet_options.append(options) + client.core.add_torrent_magnet(filename, options) else: - torrent_filenames.append(filename) - torrent_options.append(options) + from deluge.bencode import bencode + client.core.add_torrent_file( + os.path.split(filename)[-1], + base64.encodestring(bencode(self.infos[torrent_id])), + options) row = self.torrent_liststore.iter_next(row) - if torrent_filenames: - for i, f in enumerate(torrent_filenames): - client.core.add_torrent_file( - os.path.split(f)[-1], - base64.encodestring(open(f, "rb").read()), - torrent_options[i]) - if torrent_magnets: - for i, m in enumerate(torrent_magnets): - client.core.add_torrent_magnet(m, torrent_magnet_options[i]) - - client.force_call(False) self.hide() def _on_button_apply_clicked(self, widget):