diff --git a/Jellyfin.Api/Controllers/Images/ImageByNameController.cs b/Jellyfin.Api/Controllers/Images/ImageByNameController.cs
index fa6080977..db475d6b4 100644
--- a/Jellyfin.Api/Controllers/Images/ImageByNameController.cs
+++ b/Jellyfin.Api/Controllers/Images/ImageByNameController.cs
@@ -21,7 +21,6 @@ namespace Jellyfin.Api.Controllers.Images
/// Images By Name Controller.
///
[Route("Images")]
- [Authorize]
public class ImageByNameController : BaseJellyfinApiController
{
private readonly IServerApplicationPaths _applicationPaths;
@@ -46,6 +45,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Retrieved list of images.
/// An containing the list of images.
[HttpGet("General")]
+ [Authorize]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult> GetGeneralImages()
{
@@ -61,6 +61,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Image not found.
/// A containing the image contents on success, or a if the image could not be found.
[HttpGet("General/{Name}/{Type}")]
+ [AllowAnonymous]
[Produces(MediaTypeNames.Application.Octet)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
@@ -70,11 +71,11 @@ namespace Jellyfin.Api.Controllers.Images
? "folder"
: type;
- var paths = BaseItem.SupportedImageExtensions
- .Select(i => Path.Combine(_applicationPaths.GeneralPath, name, filename + i)).ToList();
+ var path = BaseItem.SupportedImageExtensions
+ .Select(i => Path.Combine(_applicationPaths.GeneralPath, name, filename + i))
+ .FirstOrDefault(System.IO.File.Exists);
- var path = paths.FirstOrDefault(System.IO.File.Exists) ?? paths.FirstOrDefault();
- if (path == null || !System.IO.File.Exists(path))
+ if (path == null)
{
return NotFound();
}
@@ -89,6 +90,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Retrieved list of images.
/// An containing the list of images.
[HttpGet("Ratings")]
+ [Authorize]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult> GetRatingImages()
{
@@ -104,6 +106,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Image not found.
/// A containing the image contents on success, or a if the image could not be found.
[HttpGet("Ratings/{Theme}/{Name}")]
+ [AllowAnonymous]
[Produces(MediaTypeNames.Application.Octet)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
@@ -120,6 +123,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Image list retrieved.
/// An containing the list of images.
[HttpGet("MediaInfo")]
+ [Authorize]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult> GetMediaInfoImages()
{
@@ -135,6 +139,7 @@ namespace Jellyfin.Api.Controllers.Images
/// Image not found.
/// A containing the image contents on success, or a if the image could not be found.
[HttpGet("MediaInfo/{Theme}/{Name}")]
+ [AllowAnonymous]
[Produces(MediaTypeNames.Application.Octet)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]