diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs index 02cbf6246e..e37562f130 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 @@ public void should_return_status_with_outputdirs() 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 21fff88595..852dd0423b 100644 --- a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs @@ -53,7 +53,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string _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 b43092da0f..e49aa064f4 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -11,6 +11,7 @@ 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 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string _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 c1a81add35..1f810b38f1 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -85,11 +85,6 @@ public override string Download(RemoteEpisode remoteEpisode) hash = DownloadFromWebUrl(remoteEpisode, torrentUrl); } - if (hash == null) - { - throw new ReleaseDownloadException(remoteEpisode.Release, "Downloading torrent failed"); - } - return hash; } @@ -147,9 +142,9 @@ private string DownloadFromWebUrl(RemoteEpisode remoteEpisode, string torrentUrl 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 @@ private string DownloadFromMagnetUrl(RemoteEpisode remoteEpisode, string magnetU 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); }