From 06b88b60063e24d5a09be937b5273a135dd78840 Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Mon, 21 Sep 2026 15:32:53 -0300 Subject: [PATCH] fix(workorders): align media multipart limit --- .../WorkOrderMediaControllerTests.cs | 10 ++++++++++ .../Controllers/WorkOrderMediaController.cs | 1 + 2 files changed, 11 insertions(+) diff --git a/Api.SeaHavenIndustries.Tests/WorkOrderMediaControllerTests.cs b/Api.SeaHavenIndustries.Tests/WorkOrderMediaControllerTests.cs index cccc694..a29b332 100644 --- a/Api.SeaHavenIndustries.Tests/WorkOrderMediaControllerTests.cs +++ b/Api.SeaHavenIndustries.Tests/WorkOrderMediaControllerTests.cs @@ -42,6 +42,16 @@ public class WorkOrderMediaControllerTests Assert.Equal(200_000_000L, bytes.Value); } + [Fact] + public void AddMedia_HasTwoHundredMegabyteMultipartBodyLimit() + { + var method = typeof(WorkOrderMediaController).GetMethod(nameof(WorkOrderMediaController.AddMedia)); + var attribute = Assert.IsType(Assert.Single( + method!.GetCustomAttributes(typeof(RequestFormLimitsAttribute), inherit: true))); + + Assert.Equal(200_000_000L, attribute.MultipartBodyLengthLimit); + } + [Fact] public async Task AddMedia_FileOverLimit_ReturnsStableUnprocessableEntity() { diff --git a/Api.SeaHavenIndustries/Controllers/WorkOrderMediaController.cs b/Api.SeaHavenIndustries/Controllers/WorkOrderMediaController.cs index e1fb049..17b3ba3 100644 --- a/Api.SeaHavenIndustries/Controllers/WorkOrderMediaController.cs +++ b/Api.SeaHavenIndustries/Controllers/WorkOrderMediaController.cs @@ -75,6 +75,7 @@ namespace Api.SeaHavenIndustries.Controllers [HttpPost("{id:int}/media")] [RequestSizeLimit(MaxUploadBytes)] + [RequestFormLimits(MultipartBodyLengthLimit = MaxUploadBytes)] public async Task AddMedia( int id, [FromForm] WorkOrderMediaCategory? category,