Fix GetImage endpoint to proxy images instead of redirecting

This commit is contained in:
2026-02-03 19:02:42 -05:00
parent 9f8b3d65fb
commit f7a88791e8

View File

@@ -940,24 +940,19 @@ public class JellyfinController : ControllerBase
if (!isExternal)
{
// Redirect to Jellyfin directly for local content images
var queryString = new List<string>();
if (maxWidth.HasValue) queryString.Add($"maxWidth={maxWidth.Value}");
if (maxHeight.HasValue) queryString.Add($"maxHeight={maxHeight.Value}");
// Proxy image from Jellyfin for local content
var (imageBytes, contentType) = await _proxyService.GetImageAsync(
itemId,
imageType,
maxWidth,
maxHeight);
var path = $"Items/{itemId}/Images/{imageType}";
if (imageIndex > 0)
if (imageBytes == null || contentType == null)
{
path = $"Items/{itemId}/Images/{imageType}/{imageIndex}";
return NotFound();
}
if (queryString.Any())
{
path = $"{path}?{string.Join("&", queryString)}";
}
var jellyfinUrl = $"{_settings.Url?.TrimEnd('/')}/{path}";
return Redirect(jellyfinUrl);
return File(imageBytes, contentType);
}
// Get external cover art URL