diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs index 02cbf6246..e37562f13 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs @@ -196,5 +196,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole result.OutputRootFolders.Should().NotBeNull(); result.OutputRootFolders.First().Should().Be(_completedDownloadFolder); } + + [Test] + public void should_return_null_hash() + { + var remoteEpisode = CreateRemoteEpisode(); + + Subject.Download(remoteEpisode).Should().BeNull(); + } } } diff --git a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs index 21fff8859..852dd0423 100644 --- a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Download.Clients.TorrentBlackhole _logger.Debug("Torrent Download succeeded, saved to: {0}", filepath); - return hash; + return null; } public override string Name diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs index b43092da0..e49aa064f 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -11,6 +11,7 @@ using NLog; using NzbDrone.Core.Validation; using FluentValidation.Results; using NzbDrone.Core.Download.Clients.rTorrent; +using NzbDrone.Core.Exceptions; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -85,8 +86,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent _logger.Debug("rTorrent could not add file"); RemoveItem(hash, true); - - return null; + throw new ReleaseDownloadException(remoteEpisode.Release, "Downloading torrent failed"); } } diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index c1a81add3..1f810b38f 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -85,11 +85,6 @@ namespace NzbDrone.Core.Download hash = DownloadFromWebUrl(remoteEpisode, torrentUrl); } - if (hash == null) - { - throw new ReleaseDownloadException(remoteEpisode.Release, "Downloading torrent failed"); - } - return hash; } @@ -147,9 +142,9 @@ namespace NzbDrone.Core.Download var hash = _torrentFileInfoReader.GetHashFromTorrentFile(torrentFile); var actualHash = AddFromTorrentFile(remoteEpisode, hash, filename, torrentFile); - if (hash != actualHash) + if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash) { - _logger.Warn( + _logger.Debug( "{0} did not return the expected InfoHash for '{1}', Sonarr could potentially lose track of the download in progress.", Definition.Implementation, remoteEpisode.Release.DownloadUrl); } @@ -179,9 +174,9 @@ namespace NzbDrone.Core.Download actualHash = AddFromMagnetLink(remoteEpisode, hash, magnetUrl); } - if (hash != actualHash) + if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash) { - _logger.Warn( + _logger.Debug( "{0} did not return the expected InfoHash for '{1}', Sonarr could potentially lose track of the download in progress.", Definition.Implementation, remoteEpisode.Release.DownloadUrl); }