Fixed: Ensure indexer errors are handled before processing response

(cherry picked from commit 76f93c8415419f0c3dab90582d47a1c9a653263c)

Closes #2458
This commit is contained in:
Bogdan 2023-05-07 20:29:51 +03:00
parent e9ada0b43d
commit 3a274bdc4a
3 changed files with 14 additions and 2 deletions

View file

@ -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 @@ public EzrssTorrentRssParser()
protected override bool PreProcess(IndexerResponse indexerResponse)
{
base.PreProcess(indexerResponse);
var document = LoadXmlDocument(indexerResponse);
var items = GetItems(document).ToList();
@ -24,7 +26,7 @@ protected override bool PreProcess(IndexerResponse indexerResponse)
throw new IndexerException(indexerResponse, "No results were found");
}
return base.PreProcess(indexerResponse);
return true;
}
protected override long GetSize(XElement item)

View file

@ -50,6 +50,11 @@ public static void CheckError(XDocument xdoc, IndexerResponse indexerResponse)
protected override bool PreProcess(IndexerResponse indexerResponse)
{
if (indexerResponse.HttpResponse.HasHttpError)
{
base.PreProcess(indexerResponse);
}
var xdoc = LoadXmlDocument(indexerResponse);
CheckError(xdoc, indexerResponse);

View file

@ -19,6 +19,11 @@ public TorznabRssParser()
protected override bool PreProcess(IndexerResponse indexerResponse)
{
if (indexerResponse.HttpResponse.HasHttpError)
{
base.PreProcess(indexerResponse);
}
var xdoc = LoadXmlDocument(indexerResponse);
var error = xdoc.Descendants("error").FirstOrDefault();