Allow changing of multipart form upload limit

This commit is contained in:
Masu Baumgartner
2024-06-22 20:03:27 +02:00
committed by GitHub
parent 7c2db9bb00
commit d9d17c8342

View File

@@ -25,6 +25,7 @@ using Moonlight.Core.Attributes;
using Moonlight.Core.Http.Middleware; using Moonlight.Core.Http.Middleware;
using Moonlight.Core.Implementations.ApiDefinition; using Moonlight.Core.Implementations.ApiDefinition;
using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerGen;
using Microsoft.AspNetCore.Http.Features;
namespace Moonlight.Core; namespace Moonlight.Core;
@@ -96,6 +97,12 @@ public class CoreFeature : MoonlightFeature
options.Limits.MaxRequestBodySize = ByteSizeValue.FromMegaBytes(config.Http.UploadLimit).Bytes; options.Limits.MaxRequestBodySize = ByteSizeValue.FromMegaBytes(config.Http.UploadLimit).Bytes;
}); });
// Setup http upload limit in forms
context.Builder.Services.Configure<FormOptions>(x =>
{
x.MultipartBodyLengthLimit = ByteSizeValue.FromMegaBytes(config.Http.UploadLimit).Bytes;
});
// Assets // Assets
// - Javascript // - Javascript