mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
fixed input validation for indexers
This commit is contained in:
@@ -64,7 +64,7 @@ namespace NzbDrone.Api.Indexers
|
||||
indexer.InjectFrom(indexerResource);
|
||||
indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields);
|
||||
|
||||
ValidateSetting(indexer.Settings);
|
||||
ValidateIndexer(indexer);
|
||||
|
||||
indexer = _indexerService.Update(indexer);
|
||||
|
||||
@@ -75,13 +75,16 @@ namespace NzbDrone.Api.Indexers
|
||||
}
|
||||
|
||||
|
||||
private static void ValidateSetting(IIndexerSetting setting)
|
||||
private static void ValidateIndexer(Indexer indexer)
|
||||
{
|
||||
var validationResult = setting.Validate();
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
if (indexer.Enable)
|
||||
{
|
||||
throw new ValidationException(validationResult.Errors);
|
||||
var validationResult = indexer.Settings.Validate();
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
throw new ValidationException(validationResult.Errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +103,7 @@ namespace NzbDrone.Api.Indexers
|
||||
indexer.InjectFrom(indexerResource);
|
||||
indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields);
|
||||
|
||||
ValidateSetting(indexer.Settings);
|
||||
ValidateIndexer(indexer);
|
||||
|
||||
return indexer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user