From 803e87ca5fa3aac02bf327384b7f02a182a4fa40 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sat, 2 Aug 2025 21:59:11 +0200 Subject: Don't fail image saving on missing BaseItem --- Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Jellyfin.Server.Implementations') diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index c42336d26..d59eba690 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -482,6 +482,13 @@ public sealed class BaseItemRepository var images = item.ImageInfos.Select(e => Map(item.Id, e)); using var context = _dbProvider.CreateDbContext(); + + if (!context.BaseItems.Any(bi => bi.Id == item.Id)) + { + _logger.LogWarning("Unable to save ImageInfo for non existing BaseItem"); + return; + } + context.BaseItemImageInfos.Where(e => e.ItemId == item.Id).ExecuteDelete(); context.BaseItemImageInfos.AddRange(images); context.SaveChanges(); -- cgit v1.2.3