mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 13:25:13 +02:00
@@ -70,7 +70,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
|||||||
{
|
{
|
||||||
_logger.Warn(ex, "Failed to authenticate with Avistaz");
|
_logger.Warn(ex, "Failed to authenticate with Avistaz");
|
||||||
|
|
||||||
var jsonResponse = STJson.Deserialize<AvistazErrorResponse>(ex.Response.Content);
|
STJson.TryDeserialize<AvistazErrorResponse>(ex.Response.Content, out var jsonResponse);
|
||||||
throw new IndexerAuthException(jsonResponse?.Message ?? "Unauthorized request to indexer");
|
throw new IndexerAuthException(jsonResponse?.Message ?? "Unauthorized request to indexer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,8 +98,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
|||||||
{
|
{
|
||||||
_logger.Warn(ex, "Unauthorized request to indexer");
|
_logger.Warn(ex, "Unauthorized request to indexer");
|
||||||
|
|
||||||
var jsonResponse = new HttpResponse<AvistazErrorResponse>(ex.Response);
|
STJson.TryDeserialize<AvistazErrorResponse>(ex.Response.Content, out var jsonResponse);
|
||||||
return new ValidationFailure(string.Empty, jsonResponse.Resource?.Message ?? "Unauthorized request to indexer");
|
return new ValidationFailure(string.Empty, jsonResponse?.Message ?? "Unauthorized request to indexer");
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Warn(ex, "Unable to connect to indexer");
|
_logger.Warn(ex, "Unable to connect to indexer");
|
||||||
@@ -134,7 +134,10 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
|||||||
|
|
||||||
var response = await ExecuteAuth(authLoginRequest);
|
var response = await ExecuteAuth(authLoginRequest);
|
||||||
|
|
||||||
var authResponse = STJson.Deserialize<AvistazAuthResponse>(response.Content);
|
if (!STJson.TryDeserialize<AvistazAuthResponse>(response.Content, out var authResponse))
|
||||||
|
{
|
||||||
|
throw new Exception("Invalid response from AvistaZ, the response is not valid JSON");
|
||||||
|
}
|
||||||
|
|
||||||
return authResponse.Token;
|
return authResponse.Token;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user