From fe164c1def52067a20a207082364f68f6933acfa 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) --- src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs | 8 ++++---- src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs | 5 +++++ src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs index 0e7dd333f..b174b8573 100644 --- a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs +++ b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs @@ -1,6 +1,4 @@ -using System.Linq; -using System.Xml.Linq; -using NzbDrone.Common.Extensions; +using System.Linq; using NzbDrone.Core.Indexers.Exceptions; namespace NzbDrone.Core.Indexers @@ -20,6 +18,8 @@ namespace NzbDrone.Core.Indexers protected override bool PreProcess(IndexerResponse indexerResponse) { + base.PreProcess(indexerResponse); + var document = LoadXmlDocument(indexerResponse); var items = GetItems(document).ToList(); @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers throw new IndexerException(indexerResponse, "No results were found"); } - return base.PreProcess(indexerResponse); + return true; } } } diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs index c7544e8db..906590193 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRssParser.cs @@ -56,6 +56,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 5d5f32213..aaa585741 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs @@ -21,6 +21,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();