From 2a1421f4888011345dd55686312af4721da9aa72 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Mon, 16 Jul 2018 19:16:26 +0200 Subject: [PATCH] Fixed: Skip torrents in Deluge api that don't have hashes. closes #2566 closes #2567 closes #2664 --- .../DelugeTests/DelugeFixture.cs | 18 ++++++++++++++++++ .../Download/Clients/Deluge/Deluge.cs | 1 + 2 files changed, 19 insertions(+) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs index f9bbc2ed0..0b090782e 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs @@ -290,6 +290,24 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests item.CanBeRemoved.Should().Be(canBeRemoved); } + [Test] + public void GetItems_should_ignore_items_without_hash() + { + _downloading.Hash = null; + + GivenTorrents(new List + { + _downloading, + _queued + }); + + var items = Subject.GetItems(); + + items.Should().HaveCount(1); + + items.First().Status.Should().Be(DownloadItemStatus.Queued); + } + [Test] public void should_return_status_with_outputdirs() { diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 926ca7f05..038ffbacf 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -105,6 +105,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge foreach (var torrent in torrents) { if (torrent.Hash == null) continue; + var item = new DownloadClientItem(); item.DownloadId = torrent.Hash.ToUpper(); item.Title = torrent.Name;