Fixed: Ensure indexer errors are handled before processing response

This commit is contained in:
Bogdan 2023-05-07 20:29:51 +03:00 committed by GitHub
parent 8f482c534f
commit 76f93c8415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -1,6 +1,4 @@
using System.Linq; using System.Linq;
using System.Xml.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
namespace NzbDrone.Core.Indexers namespace NzbDrone.Core.Indexers
@ -20,6 +18,8 @@ namespace NzbDrone.Core.Indexers
protected override bool PreProcess(IndexerResponse indexerResponse) protected override bool PreProcess(IndexerResponse indexerResponse)
{ {
base.PreProcess(indexerResponse);
var document = LoadXmlDocument(indexerResponse); var document = LoadXmlDocument(indexerResponse);
var items = GetItems(document).ToList(); var items = GetItems(document).ToList();
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers
throw new IndexerException(indexerResponse, "No results were found"); throw new IndexerException(indexerResponse, "No results were found");
} }
return base.PreProcess(indexerResponse); return true;
} }
} }
} }

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using MonoTorrent;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -52,6 +50,11 @@ namespace NzbDrone.Core.Indexers.Newznab
protected override bool PreProcess(IndexerResponse indexerResponse) protected override bool PreProcess(IndexerResponse indexerResponse)
{ {
if (indexerResponse.HttpResponse.HasHttpError)
{
base.PreProcess(indexerResponse);
}
var xdoc = LoadXmlDocument(indexerResponse); var xdoc = LoadXmlDocument(indexerResponse);
CheckError(xdoc, indexerResponse); CheckError(xdoc, indexerResponse);

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
@ -19,6 +19,11 @@ namespace NzbDrone.Core.Indexers.Torznab
protected override bool PreProcess(IndexerResponse indexerResponse) protected override bool PreProcess(IndexerResponse indexerResponse)
{ {
if (indexerResponse.HttpResponse.HasHttpError)
{
base.PreProcess(indexerResponse);
}
var xdoc = LoadXmlDocument(indexerResponse); var xdoc = LoadXmlDocument(indexerResponse);
var error = xdoc.Descendants("error").FirstOrDefault(); var error = xdoc.Descendants("error").FirstOrDefault();