From 772e30ddec8a8201863c7bc9c761fc53d067af7e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 18 Oct 2024 07:34:58 -0500 Subject: set request limit for share upload to 10gb --- src/slskd/Relay/API/Controllers/RelayController.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/slskd/Relay/API/Controllers') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index 3d374aa8..c0f65298 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -42,6 +42,8 @@ namespace slskd.Relay [ApiController] public class RelayController : ControllerBase { + private const long TEN_GIGABYTES = 10L * 1024L * 1024L * 1024L; + /// /// Initializes a new instance of the class. /// @@ -105,7 +107,7 @@ namespace slskd.Relay /// [HttpGet("controller/downloads/{token}")] [Authorize(Policy = AuthPolicy.ApiKeyOnly, Roles = AuthRole.Any)] - public IActionResult DownloadFile([FromRoute]string token) + public IActionResult DownloadFile([FromRoute] string token) { if (!OptionsAtStartup.Relay.Enabled || !new[] { RelayMode.Controller, RelayMode.Debug }.Contains(OperationMode)) { @@ -155,8 +157,8 @@ namespace slskd.Relay /// The unique identifier for the request. /// [HttpPost("controller/files/{token}")] - [RequestSizeLimit(10L * 1024L * 1024L * 1024L)] - [RequestFormLimits(MultipartBodyLengthLimit = 10L * 1024L * 1024L * 1024L)] + [RequestSizeLimit(TEN_GIGABYTES)] + [RequestFormLimits(MultipartBodyLengthLimit = TEN_GIGABYTES)] [DisableFormValueModelBinding] [Authorize(Policy = AuthPolicy.ApiKeyOnly, Roles = AuthRole.ReadWriteOrAdministrator)] public async Task UploadFile(string token) @@ -253,6 +255,8 @@ namespace slskd.Relay /// The unique identifier for the request. /// [HttpPost("controller/shares/{token}")] + [RequestSizeLimit(TEN_GIGABYTES)] + [RequestFormLimits(MultipartBodyLengthLimit = TEN_GIGABYTES)] [Authorize(Policy = AuthPolicy.ApiKeyOnly, Roles = AuthRole.ReadWriteOrAdministrator)] public async Task UploadShares(string token) { -- cgit v1.2.3