diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-08-25 18:22:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-25 18:22:02 -0400 |
| commit | 118940fff8c056ac72b8f69327a7adceacac23d9 (patch) | |
| tree | b1c7b5e2be59bd3faa3edbc73983e5e37c8ab7e9 | |
| parent | 422b2bb3d9193bfe0813d3d654919151eb355d82 (diff) | |
| parent | 3fafdbc2811af754a41ee89e56dc71bd1fb1a099 (diff) | |
Merge pull request #17711 from Shadowghost/fix-image-logging
Say which image and item failed instead of logging a blank path
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 2bba659a23..789823ddbf 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -2527,9 +2527,15 @@ namespace Emby.Server.Implementations.Library } } - if (!File.Exists(image.Path)) - { - _logger.LogWarning("Image not found at {ImagePath}", image.Path); + if (string.IsNullOrEmpty(image.Path) || !File.Exists(image.Path)) + { + _logger.LogWarning( + "{ImageType} image for {ItemName} ({ItemId}) not found at \"{ImagePath}\", source was {SourcePath}", + img.Type, + item.Name, + item.Id, + image.Path, + img.Path); continue; } @@ -3603,7 +3609,20 @@ namespace Emby.Server.Implementations.Library await item.UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); - return item.GetImageInfo(image.Type, imageIndex); + var localImage = item.GetImageInfo(image.Type, imageIndex); + if (localImage is null) + { + throw new InvalidOperationException(string.Format( + CultureInfo.InvariantCulture, + "Downloaded {0} image {1} from {2} is not attached to {3} ({4})", + image.Type, + imageIndex, + url, + item.Name, + item.Id)); + } + + return localImage; } catch (HttpRequestException ex) { @@ -3625,7 +3644,13 @@ namespace Emby.Server.Implementations.Library await item.UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); } - throw new InvalidOperationException("Unable to convert any images to local"); + throw new InvalidOperationException(string.Format( + CultureInfo.InvariantCulture, + "Unable to convert any {0} image url in \"{1}\" to a local file for {2} ({3})", + image.Type, + image.Path, + item.Name, + item.Id)); } public async Task AddVirtualFolder(string name, CollectionTypeOptions? collectionType, LibraryOptions options, bool refreshLibrary) |
