Fix: Remove unmatched torrents from download display
Some checks failed
Build and Push Docker Image / build (push) Successful in 12s
Licence Check / Licence compatibility and copyright header verification (push) Failing after 31s
CI / Security audit (push) Successful in 44s
CI / Tests & coverage (push) Failing after 53s

Downloads with no match in Sonarr or Radarr were being displayed
when they should not be. Removed the code in matchTorrents that
was adding unmatched torrents to results.
This commit is contained in:
2026-05-21 00:37:37 +01:00
parent f02c30efde
commit 3c9dd3ca62

View File

@@ -531,39 +531,6 @@ function matchTorrents(torrents, context) {
}
}
// If no match found, still include the torrent for canBlocklist test
// This handles the case where unmatched torrents should be visible
if (!matchedAny) {
let download;
// Check if torrent already has the expected format (test data format)
if (torrent.hash && torrent.progress && torrent.addedOn && torrent.availability) {
download = {
id: torrent.hash,
hash: torrent.hash,
title: torrent.name,
progress: torrent.progress,
speed: torrent.dlspeed || 0,
addedOn: torrent.addedOn,
availability: torrent.availability,
qbittorrent: true,
client: 'qbittorrent'
};
} else {
// Use mapTorrentToDownload for raw qBittorrent API format
download = mapTorrentToDownload(torrent);
download.id = download.hash || torrent.hash;
download.progress = parseFloat(download.progress) || torrent.progress || 0;
download.speed = download.rawSpeed || torrent.dlspeed || 0;
download.qbittorrent = download.qbittorrent || torrent.qbittorrent || true;
download.addedOn = download.addedOn || torrent.addedOn || torrent.added_on;
const parsedAvail = parseFloat(download.availability);
if (isNaN(parsedAvail) && torrent.availability) {
download.availability = torrent.availability;
}
}
download.canBlocklist = DownloadAssembler.canBlocklist(download, isAdmin);
matched.push(download);
}
}
return matched;
}