diff --git a/src/NzbDrone.Common/Disk/SystemFolders.cs b/src/NzbDrone.Common/Disk/SystemFolders.cs index c108e3d02..1c81ab1e0 100644 --- a/src/NzbDrone.Common/Disk/SystemFolders.cs +++ b/src/NzbDrone.Common/Disk/SystemFolders.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using NzbDrone.Common.EnvironmentInfo; @@ -24,7 +24,8 @@ namespace NzbDrone.Common.Disk "/boot", "/lib", "/sbin", - "/proc" + "/proc", + "/usr/bin" }; } } diff --git a/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs b/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs index eaa1a2201..8fd15276d 100644 --- a/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs +++ b/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs @@ -12,15 +12,5 @@ namespace Readarr.Api.V1.DownloadClient : base(downloadClientFactory, "downloadclient", ResourceMapper) { } - - protected override void Validate(DownloadClientDefinition definition, bool includeWarnings) - { - if (!definition.Enable) - { - return; - } - - base.Validate(definition, includeWarnings); - } } } diff --git a/src/Readarr.Api.V1/ImportLists/ImportListController.cs b/src/Readarr.Api.V1/ImportLists/ImportListController.cs index b89d5ea8f..6c6320bac 100644 --- a/src/Readarr.Api.V1/ImportLists/ImportListController.cs +++ b/src/Readarr.Api.V1/ImportLists/ImportListController.cs @@ -22,15 +22,5 @@ namespace Readarr.Api.V1.ImportLists SharedValidator.RuleFor(c => c.QualityProfileId).SetValidator(qualityProfileExistsValidator); SharedValidator.RuleFor(c => c.MetadataProfileId).SetValidator(metadataProfileExistsValidator); } - - protected override void Validate(ImportListDefinition definition, bool includeWarnings) - { - if (!definition.Enable) - { - return; - } - - base.Validate(definition, includeWarnings); - } } } diff --git a/src/Readarr.Api.V1/Indexers/IndexerController.cs b/src/Readarr.Api.V1/Indexers/IndexerController.cs index e5ddba576..68141f0e7 100644 --- a/src/Readarr.Api.V1/Indexers/IndexerController.cs +++ b/src/Readarr.Api.V1/Indexers/IndexerController.cs @@ -12,15 +12,5 @@ namespace Readarr.Api.V1.Indexers : base(indexerFactory, "indexer", ResourceMapper) { } - - protected override void Validate(IndexerDefinition definition, bool includeWarnings) - { - if (!definition.Enable) - { - return; - } - - base.Validate(definition, includeWarnings); - } } } diff --git a/src/Readarr.Api.V1/Metadata/MetadataController.cs b/src/Readarr.Api.V1/Metadata/MetadataController.cs index 5bf1e40c5..8af1600e1 100644 --- a/src/Readarr.Api.V1/Metadata/MetadataController.cs +++ b/src/Readarr.Api.V1/Metadata/MetadataController.cs @@ -12,15 +12,5 @@ namespace Readarr.Api.V1.Metadata : base(metadataFactory, "metadata", ResourceMapper) { } - - protected override void Validate(MetadataDefinition definition, bool includeWarnings) - { - if (!definition.Enable) - { - return; - } - - base.Validate(definition, includeWarnings); - } } } diff --git a/src/Readarr.Api.V1/Notifications/NotificationController.cs b/src/Readarr.Api.V1/Notifications/NotificationController.cs index 9abcd1d2c..27f04a6a8 100644 --- a/src/Readarr.Api.V1/Notifications/NotificationController.cs +++ b/src/Readarr.Api.V1/Notifications/NotificationController.cs @@ -12,15 +12,5 @@ namespace Readarr.Api.V1.Notifications : base(notificationFactory, "notification", ResourceMapper) { } - - protected override void Validate(NotificationDefinition definition, bool includeWarnings) - { - if (!definition.Enable) - { - return; - } - - base.Validate(definition, includeWarnings); - } } } diff --git a/src/Readarr.Api.V1/ProviderControllerBase.cs b/src/Readarr.Api.V1/ProviderControllerBase.cs index eb21ab030..6759db367 100644 --- a/src/Readarr.Api.V1/ProviderControllerBase.cs +++ b/src/Readarr.Api.V1/ProviderControllerBase.cs @@ -60,7 +60,7 @@ namespace Readarr.Api.V1 [RestPostById] public ActionResult CreateProvider(TProviderResource providerResource) { - var providerDefinition = GetDefinition(providerResource, false); + var providerDefinition = GetDefinition(providerResource, true, false, false); if (providerDefinition.Enable) { @@ -75,8 +75,8 @@ namespace Readarr.Api.V1 [RestPutById] public ActionResult UpdateProvider(TProviderResource providerResource) { - var providerDefinition = GetDefinition(providerResource, false); - var existingDefinition = _providerFactory.Get(providerDefinition.Id); + var providerDefinition = GetDefinition(providerResource, true, false, false); + var forceSave = Request.GetBooleanQueryParameter("forceSave"); // Only test existing definitions if it was previously disabled if (providerDefinition.Enable && !existingDefinition.Enable) @@ -89,11 +89,11 @@ namespace Readarr.Api.V1 return Accepted(providerResource.Id); } - private TProviderDefinition GetDefinition(TProviderResource providerResource, bool includeWarnings = false, bool validate = true) + private TProviderDefinition GetDefinition(TProviderResource providerResource, bool validate, bool includeWarnings, bool forceValidate) { var definition = _resourceMapper.ToModel(providerResource); - if (validate) + if (validate && (definition.Enable || forceValidate)) { Validate(definition, includeWarnings); } @@ -134,7 +134,7 @@ namespace Readarr.Api.V1 [HttpPost("test")] public object Test([FromBody] TProviderResource providerResource) { - var providerDefinition = GetDefinition(providerResource, true); + var providerDefinition = GetDefinition(providerResource, true, true, true); Test(providerDefinition, true); @@ -167,7 +167,7 @@ namespace Readarr.Api.V1 [HttpPost("action/{name}")] public IActionResult RequestAction(string name, [FromBody] TProviderResource resource) { - var providerDefinition = GetDefinition(resource, true, false); + var providerDefinition = GetDefinition(resource, false, false, false); var query = Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString()); @@ -176,7 +176,7 @@ namespace Readarr.Api.V1 return Content(data.ToJson(), "application/json"); } - protected virtual void Validate(TProviderDefinition definition, bool includeWarnings) + private void Validate(TProviderDefinition definition, bool includeWarnings) { var validationResult = definition.Settings.Validate();