Fixed: Definition not updating if local file is missing

pull/1139/head
Qstick 2 years ago
parent 2e85a21576
commit e4ffa1873e

@ -281,6 +281,7 @@ namespace NzbDrone.Core.IndexerVersions
private void UpdateLocalDefinitions()
{
var startupFolder = _appFolderInfo.AppDataFolder;
var definitionFolder = Path.Combine(startupFolder, "Definitions");
var request = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}");
var response = _httpClient.Get<List<CardigannMetaDefinition>>(request);
@ -291,13 +292,16 @@ namespace NzbDrone.Core.IndexerVersions
{
EnsureDefinitionsFolder();
var directoryInfo = new DirectoryInfo(definitionFolder);
var files = directoryInfo.GetFiles($"*.yml", SearchOption.TopDirectoryOnly).Select(f => Path.GetFileNameWithoutExtension(f.Name));
foreach (var def in response.Resource)
{
try
{
var saveFile = Path.Combine(startupFolder, "Definitions", $"{def.File}.yml");
var saveFile = Path.Combine(definitionFolder, $"{def.File}.yml");
if (currentDefs.TryGetValue(def.Id, out var defSha) && defSha == def.Sha)
if (currentDefs.TryGetValue(def.Id, out var defSha) && defSha == def.Sha && files.Any(x => x == def.File))
{
_logger.Trace("Indexer already up to date: {0}", def.File);

Loading…
Cancel
Save