diff --git a/src/NzbDrone.Core/Download/FailedDownloadService.cs b/src/NzbDrone.Core/Download/FailedDownloadService.cs index ff5f055e9..ccacf426b 100644 --- a/src/NzbDrone.Core/Download/FailedDownloadService.cs +++ b/src/NzbDrone.Core/Download/FailedDownloadService.cs @@ -38,12 +38,23 @@ namespace NzbDrone.Core.Download if (downloadId.IsNullOrWhiteSpace()) { PublishDownloadFailedEvent(new List { history }, "Manually marked as failed"); + + return; } - else + + var grabbedHistory = new List(); + + // If the history item is a grabbed item (it should be, at least from the UI) add it as the first history item + if (history.EventType == MovieHistoryEventType.Grabbed) { - var grabbedHistory = _historyService.Find(downloadId, MovieHistoryEventType.Grabbed).ToList(); - PublishDownloadFailedEvent(grabbedHistory, "Manually marked as failed"); + grabbedHistory.Add(history); } + + // Add any other history items for the download ID then filter out any duplicate history items. + grabbedHistory.AddRange(_historyService.Find(downloadId, MovieHistoryEventType.Grabbed)); + grabbedHistory = grabbedHistory.DistinctBy(h => h.Id).ToList(); + + PublishDownloadFailedEvent(grabbedHistory, "Manually marked as failed"); } public void MarkAsFailed(string downloadId)