a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/api] Fix emoji import request size limiter not being disabled

+29 -1
+28
Iceshrimp.Backend/Controllers/Shared/Attributes/DisableRequestSizeLimit.cs
··· 1 + using Microsoft.AspNetCore.Http.Features; 2 + using Microsoft.AspNetCore.Http.Metadata; 3 + using Microsoft.AspNetCore.Mvc.Filters; 4 + 5 + namespace Iceshrimp.Backend.Controllers.Shared.Attributes; 6 + 7 + public class NoRequestSizeLimitAttribute : Attribute, IFormOptionsMetadata, IResourceFilter 8 + { 9 + public void OnResourceExecuting(ResourceExecutingContext context) 10 + { 11 + var feature = context.HttpContext.Features.Get<IHttpMaxRequestBodySizeFeature>() ?? 12 + throw new Exception("Failed to get IHttpMaxRequestBodySizeFeature"); 13 + feature.MaxRequestBodySize = long.MaxValue; 14 + } 15 + 16 + public void OnResourceExecuted(ResourceExecutedContext context) { } 17 + 18 + public bool? BufferBody => null; 19 + public int? MemoryBufferThreshold => null; 20 + public long? BufferBodyLengthLimit => long.MaxValue; 21 + public int? ValueCountLimit => null; 22 + public int? KeyLengthLimit => null; 23 + public int? ValueLengthLimit => null; 24 + public int? MultipartBoundaryLengthLimit => null; 25 + public int? MultipartHeadersCountLimit => null; 26 + public int? MultipartHeadersLengthLimit => null; 27 + public long? MultipartBodyLengthLimit => long.MaxValue; 28 + }
+1 -1
Iceshrimp.Backend/Controllers/Web/EmojiController.cs
··· 187 187 188 188 [HttpPost("import")] 189 189 [Authorize("role:moderator")] 190 - [DisableRequestSizeLimit] 190 + [NoRequestSizeLimit] 191 191 [ProducesResults(HttpStatusCode.Accepted)] 192 192 public async Task<AcceptedResult> ImportEmoji(IFormFile file) 193 193 {