From 7f3ccf659c0babe16b12ed138ad12084599fc276 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 7 May 2023 20:29:51 +0300 Subject: [PATCH] Fixed: Ensure indexer errors are handled before processing response (cherry picked from commit 76f93c8415419f0c3dab90582d47a1c9a653263c) Closes #3628 --- src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs | 6 ++++-- src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs | 5 +++++ src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs index 7c995077a..dd5a2b3e2 100644 --- a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs +++ b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Xml.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers.Exceptions; @@ -16,6 +16,8 @@ namespace NzbDrone.Core.Indexers protected override bool PreProcess(IndexerResponse indexerResponse) { + base.PreProcess(indexerResponse); + var document = LoadXmlDocument(indexerResponse); var items = GetItems(document).ToList(); @@ -24,7 +26,7 @@ namespace NzbDrone.Core.Indexers throw new IndexerException(indexerResponse, "No results were found"); } - return base.PreProcess(indexerResponse); + return true; } protected override long GetSize(XElement item) diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs index d099cbd14..7d50e5fe8 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs @@ -50,6 +50,11 @@ namespace NzbDrone.Core.Indexers.Newznab protected override bool PreProcess(IndexerResponse indexerResponse) { + if (indexerResponse.HttpResponse.HasHttpError) + { + base.PreProcess(indexerResponse); + } + var xdoc = LoadXmlDocument(indexerResponse); CheckError(xdoc, indexerResponse); diff --git a/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs b/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs index a776aa109..97610fae6 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs @@ -19,6 +19,11 @@ namespace NzbDrone.Core.Indexers.Torznab protected override bool PreProcess(IndexerResponse indexerResponse) { + if (indexerResponse.HttpResponse.HasHttpError) + { + base.PreProcess(indexerResponse); + } + var xdoc = LoadXmlDocument(indexerResponse); var error = xdoc.Descendants("error").FirstOrDefault();