From 6a7fe3017127f4156f939a8715603dd1e5925719 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 18 May 2023 16:02:14 +0300 Subject: [PATCH] Fixed: Use indexer errors from response if Content-Type is XML before processing response (cherry picked from commit 9bdc6183663a3510e53433a30ad701065e7ee9d9) --- .../Indexers/Definitions/Headphones/HeadphonesRssParser.cs | 3 ++- .../Indexers/Definitions/Newznab/NewznabRssParser.cs | 3 ++- .../Indexers/Definitions/Torznab/TorznabRssParser.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs index 6a1081063..7768751c4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs @@ -54,7 +54,8 @@ namespace NzbDrone.Core.Indexers.Headphones protected override bool PreProcess(IndexerResponse indexerResponse) { - if (indexerResponse.HttpResponse.HasHttpError) + if (indexerResponse.HttpResponse.HasHttpError && + (indexerResponse.HttpResponse.Headers.ContentType == null || !indexerResponse.HttpResponse.Headers.ContentType.Contains("xml"))) { base.PreProcess(indexerResponse); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs index 71d127085..1f4388b87 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs @@ -58,7 +58,8 @@ namespace NzbDrone.Core.Indexers.Newznab protected override bool PreProcess(IndexerResponse indexerResponse) { - if (indexerResponse.HttpResponse.HasHttpError) + if (indexerResponse.HttpResponse.HasHttpError && + (indexerResponse.HttpResponse.Headers.ContentType == null || !indexerResponse.HttpResponse.Headers.ContentType.Contains("xml"))) { base.PreProcess(indexerResponse); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs index 11e5d23fa..953ec9f21 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs @@ -28,7 +28,8 @@ namespace NzbDrone.Core.Indexers.Torznab protected override bool PreProcess(IndexerResponse indexerResponse) { - if (indexerResponse.HttpResponse.HasHttpError) + if (indexerResponse.HttpResponse.HasHttpError && + (indexerResponse.HttpResponse.Headers.ContentType == null || !indexerResponse.HttpResponse.Headers.ContentType.Contains("xml"))) { base.PreProcess(indexerResponse); }