mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-03 01:01:34 +02:00
Fixed: Saving Newznab indexer when redirect was true
This commit is contained in:
@@ -208,12 +208,6 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
try
|
||||
{
|
||||
// Ensure Redirect is true for Usenet protocols
|
||||
if (Protocol == DownloadProtocol.Usenet || (SupportsRedirect && Redirect))
|
||||
{
|
||||
failures.Add(new ValidationFailure("Redirect", "Redirect must be enabled for Usenet indexers"));
|
||||
}
|
||||
|
||||
Test(failures).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.SignalR;
|
||||
@@ -24,5 +26,21 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
SharedValidator.RuleFor(c => c.Priority).InclusiveBetween(1, 50);
|
||||
SharedValidator.RuleFor(c => c.DownloadClientId).SetValidator(downloadClientExistsValidator);
|
||||
}
|
||||
|
||||
protected override void Validate(IndexerDefinition definition, bool includeWarnings)
|
||||
{
|
||||
var instance = _providerFactory.GetInstance(definition);
|
||||
|
||||
// Ensure Redirect is true for Usenet protocols
|
||||
if (instance is { Protocol: DownloadProtocol.Usenet, SupportsRedirect: true } && definition is { Redirect: false })
|
||||
{
|
||||
throw new ValidationException(new List<ValidationFailure>
|
||||
{
|
||||
new("Redirect", "Redirect must be enabled for Usenet indexers")
|
||||
});
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -271,7 +271,7 @@ namespace Prowlarr.Api.V1
|
||||
BroadcastResourceChange(ModelAction.Deleted, message.ProviderId);
|
||||
}
|
||||
|
||||
private void Validate(TProviderDefinition definition, bool includeWarnings)
|
||||
protected virtual void Validate(TProviderDefinition definition, bool includeWarnings)
|
||||
{
|
||||
var validationResult = definition.Settings.Validate();
|
||||
|
||||
|
Reference in New Issue
Block a user