From 6a5bb44d5b20c1404237bab5d5051a7ff8a26a65 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 18 May 2019 14:43:13 +0100 Subject: [PATCH] [Core] Write torrent file with full magnet metainfo The use of torrent_info.metadata misses saves trackers and other torrent metainfo fields so use lt.create_torrent generate method to create this data. --- deluge/core/torrent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 10e444cb5..a8e178fb9 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -1295,9 +1295,9 @@ class Torrent(object): filepath = os.path.join(get_config_dir(), 'state', self.torrent_id + '.torrent') if filedump is None: - metadata = lt.bdecode(self.torrent_info.metadata()) - torrent_file = {b'info': metadata} - filedump = lt.bencode(torrent_file) + lt_ct = lt.create_torrent(self.torrent_info) + filedump = lt.bencode(lt_ct.generate()) + write_file(filepath, filedump) # If the user has requested a copy of the torrent be saved elsewhere we need to do that.