diff --git a/src/NzbDrone.Core/IndexerSearch/NewznabResults.cs b/src/NzbDrone.Core/IndexerSearch/NewznabResults.cs index 2845b8972..20e763122 100644 --- a/src/NzbDrone.Core/IndexerSearch/NewznabResults.cs +++ b/src/NzbDrone.Core/IndexerSearch/NewznabResults.cs @@ -85,7 +85,7 @@ namespace NzbDrone.Core.IndexerSearch r.InfoUrl == null ? null : new XElement("comments", r.InfoUrl), r.PublishDate == DateTime.MinValue ? new XElement("pubDate", XmlDateFormat(DateTime.Now)) : new XElement("pubDate", XmlDateFormat(r.PublishDate)), new XElement("size", r.Size), - new XElement("link", r.DownloadUrl ?? t.MagnetUrl ?? string.Empty), + new XElement("link", r.DownloadUrl ?? string.Empty), r.Categories == null ? null : from c in r.Categories select new XElement("category", c.Id), new XElement( "enclosure", @@ -115,6 +115,7 @@ namespace NzbDrone.Core.IndexerSearch GetNabElement("label", RemoveInvalidXMLChars(r.Label), protocol), GetNabElement("track", RemoveInvalidXMLChars(r.Track), protocol), GetNabElement("infohash", RemoveInvalidXMLChars(t.InfoHash), protocol), + GetNabElement("magneturl", t.MagnetUrl, protocol), GetNabElement("minimumratio", t.MinimumRatio, protocol), GetNabElement("minimumseedtime", t.MinimumSeedTime, protocol), GetNabElement("downloadvolumefactor", t.DownloadVolumeFactor, protocol), diff --git a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs index 2189135a8..4c009b279 100644 --- a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs +++ b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs @@ -184,9 +184,11 @@ namespace NzbDrone.Api.V1.Indexers { result.DownloadUrl = result.DownloadUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(result.DownloadUrl), request.server, indexerDef.Id, result.Title).AbsoluteUri : null; - if (result.DownloadProtocol == DownloadProtocol.Torrent) + if (result.DownloadProtocol == DownloadProtocol.Torrent && + result is TorrentInfo torrentRelease && + torrentRelease.MagnetUrl.IsNotNullOrWhiteSpace()) { - ((TorrentInfo)result).MagnetUrl = ((TorrentInfo)result).MagnetUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(((TorrentInfo)result).MagnetUrl), request.server, indexerDef.Id, result.Title).AbsoluteUri : null; + result.DownloadUrl ??= _downloadMappingService.ConvertToProxyLink(new Uri(torrentRelease.MagnetUrl), request.server, indexerDef.Id, torrentRelease.Title).AbsoluteUri; } }