From b94afe53241c9b7fae28e1266b5e056d96a6fb0b Mon Sep 17 00:00:00 2001 From: Arlo Date: Tue, 26 Aug 2025 17:02:55 -0500 Subject: [PATCH] Fix image retrieval logic in AddImageCommand to handle null imageId correctly --- src/Commands/Common/Entity/Images/AddImageCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/Common/Entity/Images/AddImageCommand.cs b/src/Commands/Common/Entity/Images/AddImageCommand.cs index 52466d0..abbd126 100644 --- a/src/Commands/Common/Entity/Images/AddImageCommand.cs +++ b/src/Commands/Common/Entity/Images/AddImageCommand.cs @@ -57,7 +57,7 @@ public async Task InvokeAsync(string repo, string id, string imagePath, string? Logger.LogInformation($" {nameof(imageFile.GetType)}: {imageFile.GetType()}"); await entity.AddImageAsync(imageFile, imageId ?? imageFile.Id, imageName, cancellationToken); - var addedImage = await entity.GetImageFilesAsync(cancellationToken).FirstAsync(x=> x.Id == imageId || x.Name == imageName, cancellationToken: cancellationToken); + var addedImage = await entity.GetImageFilesAsync(cancellationToken).FirstAsync(x=> x.Id == (imageId ?? imageFile.Id) || x.Name == imageName, cancellationToken: cancellationToken); Logger.LogInformation($"Added file:"); Logger.LogInformation($"- {nameof(addedImage.Id)}: {addedImage.Id}"); Logger.LogInformation($" {nameof(addedImage.Name)}: {addedImage.Name}");