[Core] Fix torrent pause/resume logic
If the torrent_id argument received in the pause or resume methods is not a string, the methods execute with the un-parsed input and then with parsed input on a second call. A key error exception is thrown from the first call, and the second call succeeds.
This commit is contained in:
parent
f94f58918e
commit
585ea88f1f
|
@ -627,6 +627,7 @@ class Core(component.Component):
|
||||||
log.debug('Pausing: %s', torrent_id)
|
log.debug('Pausing: %s', torrent_id)
|
||||||
if not isinstance(torrent_id, str if not PY2 else basestring):
|
if not isinstance(torrent_id, str if not PY2 else basestring):
|
||||||
self.pause_torrents(torrent_id)
|
self.pause_torrents(torrent_id)
|
||||||
|
else:
|
||||||
self.torrentmanager[torrent_id].pause()
|
self.torrentmanager[torrent_id].pause()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
|
@ -677,6 +678,7 @@ class Core(component.Component):
|
||||||
log.debug('Resuming: %s', torrent_id)
|
log.debug('Resuming: %s', torrent_id)
|
||||||
if not isinstance(torrent_id, str if not PY2 else basestring):
|
if not isinstance(torrent_id, str if not PY2 else basestring):
|
||||||
self.resume_torrents(torrent_id)
|
self.resume_torrents(torrent_id)
|
||||||
|
else:
|
||||||
self.torrentmanager[torrent_id].resume()
|
self.torrentmanager[torrent_id].resume()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
|
|
Loading…
Reference in New Issue