[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.
This commit is contained in:
Calum Lind 2019-05-18 11:23:34 +01:00
parent 09cfd9b89e
commit cbcf8eb863

View File

@ -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')