mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-18 21:55:12 -04:00
Fixed: Don't fetch capabilities for disabled Newznab/Torznab indexers on create
Also prevent NullRef in GetProxy since definition is null when using FetchCapabilities on add
This commit is contained in:
@@ -281,10 +281,10 @@ namespace NzbDrone.Core.Indexers
|
|||||||
|
|
||||||
SetProviderCharacteristics(provider, definition);
|
SetProviderCharacteristics(provider, definition);
|
||||||
|
|
||||||
if (definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
if (definition.Enable && definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
||||||
{
|
{
|
||||||
var settings = (NewznabSettings)definition.Settings;
|
var settings = (NewznabSettings)definition.Settings;
|
||||||
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.Implementation == nameof(Cardigann))
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
@@ -304,7 +304,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
if (definition.Enable && definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
if (definition.Enable && definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
||||||
{
|
{
|
||||||
var settings = (NewznabSettings)definition.Settings;
|
var settings = (NewznabSettings)definition.Settings;
|
||||||
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.Implementation == nameof(Cardigann))
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
private IIndexerProxy GetProxy(ProviderDefinition definition)
|
private IIndexerProxy GetProxy(ProviderDefinition definition)
|
||||||
{
|
{
|
||||||
// Skip DB call if no tags on the indexers
|
// Skip DB call if no tags on the indexers
|
||||||
if (definition.Tags.Count == 0 && definition.Id > 0)
|
if (definition is { Id: > 0 } && definition.Tags.Count == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
var proxies = _indexerProxyFactory.GetAvailableProviders();
|
var proxies = _indexerProxyFactory.GetAvailableProviders();
|
||||||
var selectedProxy = proxies.FirstOrDefault(proxy => definition.Tags.Intersect(proxy.Definition.Tags).Any());
|
var selectedProxy = proxies.FirstOrDefault(proxy => definition.Tags.Intersect(proxy.Definition.Tags).Any());
|
||||||
|
|
||||||
if (selectedProxy == null && definition.Id == 0)
|
if (selectedProxy == null && definition is not { Id: not 0 })
|
||||||
{
|
{
|
||||||
selectedProxy = proxies.FirstOrDefault(p => p is FlareSolverr);
|
selectedProxy = proxies.FirstOrDefault(p => p is FlareSolverr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user