From 585ea88f1f79882635317e3a0e62d838783a3ab5 Mon Sep 17 00:00:00 2001 From: Deepak Date: Mon, 30 Jul 2018 16:14:50 -0500 Subject: [PATCH] [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. --- deluge/core/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 691a7c0d2..451b9a88d 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -627,7 +627,8 @@ class Core(component.Component): log.debug('Pausing: %s', torrent_id) if not isinstance(torrent_id, str if not PY2 else basestring): self.pause_torrents(torrent_id) - self.torrentmanager[torrent_id].pause() + else: + self.torrentmanager[torrent_id].pause() @export def pause_torrents(self, torrent_ids=None): @@ -677,7 +678,8 @@ class Core(component.Component): log.debug('Resuming: %s', torrent_id) if not isinstance(torrent_id, str if not PY2 else basestring): self.resume_torrents(torrent_id) - self.torrentmanager[torrent_id].resume() + else: + self.torrentmanager[torrent_id].resume() @export def resume_torrents(self, torrent_ids=None):