Simplify ShouldHaveApiKey and HasErrors

(cherry picked from commit 7343616a47cd538bba4c9128d2c1094561f9b3a5)
pull/1701/head
Bogdan 2 years ago
parent 65541017dd
commit fcfec1b859

@ -23,12 +23,7 @@ namespace NzbDrone.Core.Indexers.Newznab
private static bool ShouldHaveApiKey(NewznabSettings settings)
{
if (settings.BaseUrl == null)
{
return false;
}
return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
return settings.BaseUrl != null && ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
}
private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled);

@ -17,12 +17,7 @@ namespace NzbDrone.Core.Indexers.Torznab
private static bool ShouldHaveApiKey(TorznabSettings settings)
{
if (settings.BaseUrl == null)
{
return false;
}
return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
return settings.BaseUrl != null && ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
}
private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled);

@ -24,17 +24,7 @@ namespace NzbDrone.Core.Validation
public static bool HasErrors(this List<ValidationFailure> list)
{
foreach (var item in list)
{
if (item is NzbDroneValidationFailure { IsWarning: true })
{
continue;
}
return true;
}
return false;
return list.Any(item => item is not NzbDroneValidationFailure { IsWarning: true });
}
}
}

Loading…
Cancel
Save