From cbcf8eb8637d18374ad26ce21c5b4a8cac852970 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 18 May 2019 11:23:34 +0100 Subject: [PATCH] [GTK] Fix missing magnet trackers with Add dialog (non-prefetch) When adding magnets (without prefetch) the trackers were missing. The issue was that the magnet uri was being xml escaped twice so that the ampersand was still escaped when passed to core and everything after the magnet info_hash was ignored. Also found unneeded call to core.add_torrent_files when only adding magnets with core.add_torrent_magnet so check torrents_to_add before calling. --- deluge/ui/gtk3/addtorrentdialog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtk3/addtorrentdialog.py b/deluge/ui/gtk3/addtorrentdialog.py index 72841c616..d164c2cc5 100644 --- a/deluge/ui/gtk3/addtorrentdialog.py +++ b/deluge/ui/gtk3/addtorrentdialog.py @@ -302,7 +302,7 @@ class AddTorrentDialog(component.Component): torrent_id = magnet['info_hash'] files = magnet['files_tree'] if not self._add_torrent_liststore( - torrent_id, magnet['name'], xml_escape(uri), files, None + torrent_id, magnet['name'], uri, files, None ): already_added += 1 continue @@ -924,7 +924,10 @@ class AddTorrentDialog(component.Component): else: log.info('Successfully added %d torrents.', len(torrents_to_add)) - client.core.add_torrent_files(torrents_to_add).addCallback(on_torrents_added) + if torrents_to_add: + client.core.add_torrent_files(torrents_to_add).addCallback( + on_torrents_added + ) def on_button_apply_clicked(self, widget): log.debug('on_button_apply_clicked')