diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.cs index a4637752d1..4731a5c8b4 100644 --- a/Jellyfin.Api/Controllers/LibraryController.cs +++ b/Jellyfin.Api/Controllers/LibraryController.cs @@ -666,8 +666,7 @@ namespace Jellyfin.Api.Controllers } // TODO determine non-ASCII validity. - using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); - return File(fileStream, MimeTypes.GetMimeType(path), filename); + return PhysicalFile(path, MimeTypes.GetMimeType(path)); } /// diff --git a/Jellyfin.Api/Controllers/RemoteImageController.cs b/Jellyfin.Api/Controllers/RemoteImageController.cs index 1b26163cfc..50a161ef6e 100644 --- a/Jellyfin.Api/Controllers/RemoteImageController.cs +++ b/Jellyfin.Api/Controllers/RemoteImageController.cs @@ -25,8 +25,7 @@ namespace Jellyfin.Api.Controllers /// /// Remote Images Controller. /// - [Route("Images")] - [Authorize(Policy = Policies.DefaultAuthorization)] + [Route("")] public class RemoteImageController : BaseJellyfinApiController { private readonly IProviderManager _providerManager; @@ -65,7 +64,8 @@ namespace Jellyfin.Api.Controllers /// Remote Images returned. /// Item not found. /// Remote Image Result. - [HttpGet("{itemId}/RemoteImages")] + [HttpGet("Items/{itemId}/RemoteImages")] + [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task> GetRemoteImages( @@ -73,7 +73,7 @@ namespace Jellyfin.Api.Controllers [FromQuery] ImageType? type, [FromQuery] int? startIndex, [FromQuery] int? limit, - [FromQuery] string providerName, + [FromQuery] string? providerName, [FromQuery] bool includeAllLanguages = false) { var item = _libraryManager.GetItemById(itemId); @@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers var images = await _providerManager.GetAvailableRemoteImages( item, - new RemoteImageQuery(providerName) + new RemoteImageQuery(providerName ?? string.Empty) { IncludeAllLanguages = includeAllLanguages, IncludeDisabledProviders = true, @@ -128,7 +128,8 @@ namespace Jellyfin.Api.Controllers /// Returned remote image providers. /// Item not found. /// List of remote image providers. - [HttpGet("{itemId}/RemoteImages/Providers")] + [HttpGet("Items/{itemId}/RemoteImages/Providers")] + [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult> GetRemoteImageProviders([FromRoute] Guid itemId) @@ -149,11 +150,11 @@ namespace Jellyfin.Api.Controllers /// Remote image returned. /// Remote image not found. /// Image Stream. - [HttpGet("Remote")] + [HttpGet("Images/Remote")] [Produces(MediaTypeNames.Application.Octet)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> GetRemoteImage([FromQuery, BindRequired] string imageUrl) + public async Task GetRemoteImage([FromQuery, BindRequired] string imageUrl) { var urlHash = imageUrl.GetMD5(); var pointerCachePath = GetFullCachePath(urlHash.ToString()); @@ -202,7 +203,8 @@ namespace Jellyfin.Api.Controllers /// Remote image downloaded. /// Remote image not found. /// Download status. - [HttpPost("{itemId}/RemoteImages/Download")] + [HttpPost("Items/{itemId}/RemoteImages/Download")] + [Authorize(Policy = Policies.RequiresElevation)] [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task DownloadRemoteImage( diff --git a/MediaBrowser.Common/Json/Converters/JsonDoubleConverter.cs b/MediaBrowser.Common/Json/Converters/JsonDoubleConverter.cs index e5e9f28dae..56c0ecbe9c 100644 --- a/MediaBrowser.Common/Json/Converters/JsonDoubleConverter.cs +++ b/MediaBrowser.Common/Json/Converters/JsonDoubleConverter.cs @@ -50,7 +50,7 @@ namespace MediaBrowser.Common.Json.Converters /// Options. public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options) { - writer.WriteStringValue(value.ToString(NumberFormatInfo.InvariantInfo)); + writer.WriteNumberValue(value); } } }