Skip to content

Commit 2e5e20e

Browse files
committed
Bump incoming file size limit to 200MB
Would close #32. The ASP.NET docs on this have an example of how to do streaming for large uploads (https://learn.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-8.0#upload-large-files-with-streaming) but it looks terribly complicated and this is just basically two lines of configuration, so I'm kinda willing to try the simple option and seeing how badly it folds in practice?
1 parent 2492a1c commit 2e5e20e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

osu.Server.BeatmapSubmission/BeatmapSubmissionController.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ public async Task<IActionResult> PutBeatmapSetAsync([FromBody] PutBeatmapSetRequ
199199
[EnableRateLimiting(Program.RATE_LIMIT_POLICY)]
200200
public async Task<IActionResult> UploadFullPackageAsync(
201201
[FromRoute] uint beatmapSetId,
202-
// TODO: this won't fly on production, biggest existing beatmap archives exceed buffering limits (`MultipartBodyLengthLimit` = 128MB specifically)
203-
// potentially also https://github.com/aspnet/Announcements/issues/267
204-
// see: https://learn.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-8.0#small-and-large-files
205-
// needs further testing
206202
IFormFile beatmapArchive)
207203
{
208204
uint userId = User.GetUserId();

osu.Server.BeatmapSubmission/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Threading.RateLimiting;
44
using JetBrains.Annotations;
55
using Microsoft.AspNetCore.Authentication.JwtBearer;
6+
using Microsoft.AspNetCore.Http.Features;
67
using Microsoft.AspNetCore.HttpLogging;
78
using Microsoft.Extensions.Options;
89
using osu.Server.BeatmapSubmission.Authentication;
@@ -17,7 +18,7 @@ namespace osu.Server.BeatmapSubmission
1718
public class Program
1819
{
1920
public const string RATE_LIMIT_POLICY = "SlidingWindowRateLimiter";
20-
21+
public const int ABSOLUTE_REQUEST_SIZE_LIMIT_BYTES = 200_000_000;
2122
public const string INTEGRATION_TEST_ENVIRONMENT = "IntegrationTest";
2223

2324
public static void Main(string[] args)
@@ -169,6 +170,9 @@ public static void Main(string[] args)
169170
});
170171
}
171172

173+
builder.WebHost.ConfigureKestrel(options => options.Limits.MaxRequestBodySize = ABSOLUTE_REQUEST_SIZE_LIMIT_BYTES);
174+
builder.Services.Configure<FormOptions>(options => options.MultipartBodyLengthLimit = ABSOLUTE_REQUEST_SIZE_LIMIT_BYTES);
175+
172176
var app = builder.Build();
173177

174178
if (app.Environment.IsDevelopment())

0 commit comments

Comments
 (0)