Fixed: Prevent unknown settings implementation from failing to deserialize

(cherry picked from commit 0e2cc7851f556e928e52bb2886c7d60c13b0741e)

Log removal of invalid definitions as warnings

(cherry picked from commit 3d61719a2cc9c87ac3c92b5358bb5034aed4c2ff)
This commit is contained in:
Bogdan 2023-05-14 20:01:55 +03:00 committed by GitHub
parent eacb619cfb
commit 498722b240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -169,14 +169,13 @@ namespace NzbDrone.Core.ThingiProvider
definition.Message = provider.Message;
}
// TODO: Remove providers even if the ConfigContract can't be deserialized (this will fail to remove providers if the settings can't be deserialized).
private void RemoveMissingImplementations()
{
var storedProvider = _providerRepository.All();
foreach (var invalidDefinition in storedProvider.Where(def => GetImplementation(def) == null))
{
_logger.Debug("Removing {0} ", invalidDefinition.Name);
_logger.Warn("Removing {0}", invalidDefinition.Name);
_providerRepository.Delete(invalidDefinition);
}
}

View File

@ -54,7 +54,7 @@ namespace NzbDrone.Core.ThingiProvider
var item = parser(reader);
var impType = typeof(IProviderConfig).Assembly.FindTypeByName(item.ConfigContract);
if (body.IsNullOrWhiteSpace())
if (body.IsNullOrWhiteSpace() || impType == null)
{
item.Settings = NullConfig.Instance;
}