mirror of
https://github.com/Readarr/Readarr
synced 2026-01-04 06:33:22 +01:00
Fixed: Nullref due to InfoHash on AlreadyImportedSpec
This commit is contained in:
parent
7b288bfcd3
commit
d17e7cb13b
2 changed files with 32 additions and 2 deletions
|
|
@ -153,6 +153,36 @@ public void should_be_rejected_if_grabbed_download_id_matches_release_torrent_ha
|
|||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_accepted_if_release_torrent_hash_is_null()
|
||||
{
|
||||
var downloadId = Guid.NewGuid().ToString().ToUpper();
|
||||
|
||||
GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.Grabbed);
|
||||
GivenHistoryItem(downloadId, TITLE, _flac, HistoryEventType.DownloadImported);
|
||||
|
||||
_remoteAlbum.Release = Builder<TorrentInfo>.CreateNew()
|
||||
.With(t => t.DownloadProtocol = DownloadProtocol.Torrent)
|
||||
.With(t => t.InfoHash = null)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_accepted_if_release_torrent_hash_is_null_and_downloadId_is_null()
|
||||
{
|
||||
GivenHistoryItem(null, TITLE, _mp3, HistoryEventType.Grabbed);
|
||||
GivenHistoryItem(null, TITLE, _flac, HistoryEventType.DownloadImported);
|
||||
|
||||
_remoteAlbum.Release = Builder<TorrentInfo>.CreateNew()
|
||||
.With(t => t.DownloadProtocol = DownloadProtocol.Torrent)
|
||||
.With(t => t.InfoHash = null)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_rejected_if_release_title_matches_grabbed_event_source_title()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ public Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCrit
|
|||
continue;
|
||||
}
|
||||
|
||||
var release = subject.Release;
|
||||
var release = subject.Release;
|
||||
|
||||
if (release.DownloadProtocol == DownloadProtocol.Torrent)
|
||||
{
|
||||
var torrentInfo = release as TorrentInfo;
|
||||
|
||||
if (torrentInfo != null && torrentInfo.InfoHash.ToUpper() == lastGrabbed.DownloadId)
|
||||
if (torrentInfo?.InfoHash != null && torrentInfo.InfoHash.ToUpper() == lastGrabbed.DownloadId)
|
||||
{
|
||||
_logger.Debug("Has same torrent hash as a grabbed and imported release");
|
||||
return Decision.Reject("Has same torrent hash as a grabbed and imported release");
|
||||
|
|
|
|||
Loading…
Reference in a new issue