Fixed: (Nebulance) Don't parse invalid response as JSON

pull/1624/head
Bogdan 1 year ago
parent 4a5e923999
commit 43f881c442

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -47,6 +48,11 @@ namespace NzbDrone.Core.Indexers.Definitions
return new NebulanceParser(Settings);
}
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
{
return false;
}
protected override Task<HttpRequest> GetDownloadRequest(Uri link)
{
// Avoid using cookies to prevent redirects to login page
@ -189,6 +195,11 @@ namespace NzbDrone.Core.Indexers.Definitions
{
var torrentInfos = new List<ReleaseInfo>();
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
{
throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from API request");
}
var jsonResponse = new HttpResponse<JsonRpcResponse<NebulanceTorrents>>(indexerResponse.HttpResponse).Resource;
if (jsonResponse.Error != null || jsonResponse.Result == null)

Loading…
Cancel
Save