Skip to content

Commit

Permalink
fix TB free free active item logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBeastLT committed Nov 29, 2024
1 parent 01f5ebd commit d8ddec1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addon/moch/torbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ async function freeLastActiveTorrent(apiKey) {
if (seedingTorrent) {
return controlTorrent(apiKey, seedingTorrent.id, 'stop_seeding');
}
if (torrents.filter(statusDownloading).pop()) {
return controlTorrent(apiKey, seedingTorrent.id, 'delete');
const downloadingTorrent = torrents.filter(statusDownloading).pop();
if (downloadingTorrent) {
return controlTorrent(apiKey, downloadingTorrent.id, 'delete');
}
return Promise.reject({ detail: 'No torrent to pause found' });
}
Expand Down

0 comments on commit d8ddec1

Please sign in to comment.