[Core|Py3] Fix fastresume data not being loaded

Decode the resume_data dict keys to fix lookups with torrent_id strings
not finding resume_data.
This commit is contained in:
Calum Lind 2018-11-17 12:12:55 +00:00
parent 1a4ac93fbb
commit 63cc745f5b
1 changed files with 3 additions and 0 deletions

View File

@ -1072,8 +1072,11 @@ class TorrentManager(component.Component):
log.warning('Unable to load %s: %s', _filepath, ex) log.warning('Unable to load %s: %s', _filepath, ex)
resume_data = None resume_data = None
else: else:
# lt.bdecode returns the dict keys as bytes so decode them.
resume_data = {k.decode(): v for k, v in resume_data.items()}
log.info('Successfully loaded %s: %s', filename, _filepath) log.info('Successfully loaded %s: %s', filename, _filepath)
break break
# If the libtorrent bdecode doesn't happen properly, it will return None # If the libtorrent bdecode doesn't happen properly, it will return None
# so we need to make sure we return a {} # so we need to make sure we return a {}
if resume_data is None: if resume_data is None: