Don't throw error on pushed releases with empty indexer or download client IDs

This commit is contained in:
Bogdan 2026-04-25 04:48:10 +03:00 committed by GitHub
parent 04d98098e0
commit 6214803a5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -60,9 +60,9 @@ public DownloadClientDefinition ResolveDownloadClient(int? id, string name)
{
var all = All();
var clientByName = name.IsNullOrWhiteSpace() ? null : all.FirstOrDefault(c => c.Name.EqualsIgnoreCase(name));
var clientById = id.HasValue ? all.FirstOrDefault(c => c.Id == id.Value) : null;
var clientById = id is > 0 ? all.FirstOrDefault(c => c.Id == id.Value) : null;
if (id.HasValue && clientById == null)
if (id is > 0 && clientById == null)
{
throw new ResolveDownloadClientException("Download client with ID '{0}' could not be found", id.Value);
}

View file

@ -96,9 +96,9 @@ public IndexerDefinition ResolveIndexer(int? id, string name)
{
var all = All();
var clientByName = name.IsNullOrWhiteSpace() ? null : all.FirstOrDefault(c => c.Name.EqualsIgnoreCase(name));
var clientById = id.HasValue ? all.FirstOrDefault(c => c.Id == id.Value) : null;
var clientById = id is > 0 ? all.FirstOrDefault(c => c.Id == id.Value) : null;
if (id.HasValue && clientById == null)
if (id is > 0 && clientById == null)
{
throw new ResolveIndexerException("Indexer with ID '{0}' could not be found", id.Value);
}
@ -115,7 +115,7 @@ public IndexerDefinition ResolveIndexer(int? id, string name)
if (clientByName != null && clientById != null && clientByName.Id != clientById.Id)
{
throw new ResolveIndexerException("Indexer with name '{0}' does not match Indexerwith ID '{1}'", name, id.Value);
throw new ResolveIndexerException("Indexer with name '{0}' does not match indexer with ID '{1}'", name, id.Value);
}
return clientById ?? clientByName;