diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-10-18 07:34:58 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-10-18 07:34:58 -0500 |
| commit | 772e30ddec8a8201863c7bc9c761fc53d067af7e (patch) | |
| tree | 65958d8cc3da51f75beb95690102f68a5f10a83b /src/slskd/Relay | |
| parent | bac18981efba4daa4e4668dd382b7fbed8765636 (diff) | |
| download | slskd-772e30ddec8a8201863c7bc9c761fc53d067af7e.tar.gz | |
set request limit for share upload to 10gb
Diffstat (limited to 'src/slskd/Relay')
| -rw-r--r-- | src/slskd/Relay/API/Controllers/RelayController.cs | 10 |
1 files changed, 7 insertions, 3 deletions
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; + /// <summary> /// Initializes a new instance of the <see cref="RelayController"/> class. /// </summary> @@ -105,7 +107,7 @@ namespace slskd.Relay /// <returns></returns> [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 /// <param name="token">The unique identifier for the request.</param> /// <returns></returns> [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<IActionResult> UploadFile(string token) @@ -253,6 +255,8 @@ namespace slskd.Relay /// <param name="token">The unique identifier for the request.</param> /// <returns></returns> [HttpPost("controller/shares/{token}")] + [RequestSizeLimit(TEN_GIGABYTES)] + [RequestFormLimits(MultipartBodyLengthLimit = TEN_GIGABYTES)] [Authorize(Policy = AuthPolicy.ApiKeyOnly, Roles = AuthRole.ReadWriteOrAdministrator)] public async Task<IActionResult> UploadShares(string token) { |
