[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.
This commit is contained in:
Calum Lind 2019-05-18 14:43:13 +01:00
parent cbcf8eb863
commit 6a5bb44d5b
1 changed files with 3 additions and 3 deletions

View File

@ -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.