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,