diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-07-10 15:08:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-10 15:08:47 +0200 |
| commit | c47390914ca0d7f58941291f160788bc1ed9fe0d (patch) | |
| tree | 48540734e3d1534a2c72802852e50a2532bdd2b4 | |
| parent | 94d5d630a8184bacc537cb1d51c93332c737f7e6 (diff) | |
| parent | 43b0d0fa9528e3fbad1af647ee61772e319f4eaa (diff) | |
Merge pull request #6276 from crobibero/bitrate-test
| -rw-r--r-- | Jellyfin.Api/Controllers/MediaInfoController.cs | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.cs index e330f02b6..e7a7a6add 100644 --- a/Jellyfin.Api/Controllers/MediaInfoController.cs +++ b/Jellyfin.Api/Controllers/MediaInfoController.cs @@ -302,27 +302,12 @@ namespace Jellyfin.Api.Controllers /// </summary> /// <param name="size">The bitrate. Defaults to 102400.</param> /// <response code="200">Test buffer returned.</response> - /// <response code="400">Size has to be a numer between 0 and 10,000,000.</response> /// <returns>A <see cref="FileResult"/> with specified bitrate.</returns> [HttpGet("Playback/BitrateTest")] [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [Produces(MediaTypeNames.Application.Octet)] [ProducesFile(MediaTypeNames.Application.Octet)] - public ActionResult GetBitrateTestBytes([FromQuery] int size = 102400) + public ActionResult GetBitrateTestBytes([FromQuery][Range(1, 100_000_000, ErrorMessage = "The requested size must be greater than or equal to {1} and less than or equal to {2}")] int size = 102400) { - const int MaxSize = 10_000_000; - - if (size <= 0) - { - return BadRequest($"The requested size ({size}) is equal to or smaller than 0."); - } - - if (size > MaxSize) - { - return BadRequest($"The requested size ({size}) is larger than the max allowed value ({MaxSize})."); - } - byte[] buffer = ArrayPool<byte>.Shared.Rent(size); try { |
