From 04fa7d366dd4fd849a420729d1c27525e35bde2e Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 13 Oct 2024 20:08:54 +0300 Subject: [PATCH] Fixed: (Cardigann) Redirect warnings with "Refresh" header --- .../Definitions/Cardigann/CardigannParser.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs index 8edc7d6de..28be1c3e5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs @@ -39,22 +39,22 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann var indexerLogging = _configService.LogIndexerResponse; - if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK) + if (indexerResponse.HttpResponse.HasHttpRedirect && indexerResponse.HttpResponse.RedirectUrl.IsNotNullOrWhiteSpace()) { - if (indexerResponse.HttpResponse.HasHttpRedirect) - { - _logger.Warn("Redirected to {0} from indexer request", indexerResponse.HttpResponse.RedirectUrl); - - if (indexerResponse.HttpResponse.RedirectUrl.ContainsIgnoreCase("/login.php")) - { - // Remove cookie cache - CookiesUpdater(null, null); - throw new IndexerException(indexerResponse, "We are being redirected to the login page. Most likely your session expired or was killed. Recheck your cookie or credentials and try testing the indexer."); - } + _logger.Warn("Redirected to {0} from indexer request", indexerResponse.HttpResponse.RedirectUrl); - throw new IndexerException(indexerResponse, $"Redirected to {indexerResponse.HttpResponse.RedirectUrl} from indexer request"); + if (indexerResponse.HttpResponse.RedirectUrl.ContainsIgnoreCase("/login.php")) + { + // Remove cookie cache + CookiesUpdater(null, null); + throw new IndexerException(indexerResponse, "We are being redirected to the login page. Most likely your session expired or was killed. Recheck your cookie or credentials and try testing the indexer."); } + throw new IndexerException(indexerResponse, $"Redirected to {indexerResponse.HttpResponse.RedirectUrl} from indexer request"); + } + + if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK) + { throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from indexer request"); }