From f7a88791e89c01021d2d82c0661b8a77c5a1b49a Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Tue, 3 Feb 2026 19:02:42 -0500 Subject: [PATCH] Fix GetImage endpoint to proxy images instead of redirecting --- allstarr/Controllers/JellyfinController.cs | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs index 84ff490..c377c30 100644 --- a/allstarr/Controllers/JellyfinController.cs +++ b/allstarr/Controllers/JellyfinController.cs @@ -940,24 +940,19 @@ public class JellyfinController : ControllerBase if (!isExternal) { - // Redirect to Jellyfin directly for local content images - var queryString = new List(); - 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