fix session report submission: raise body size limit from 1 MB to 20 MB

Reports with screenshots and agent logs easily exceed 1 MB after base64
encoding. 20 MB accommodates 5 MB agent logs (~6.7 MB base64) plus
multi-MB screenshots plus CSV/TXT exports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Oliver Kieselbach
2026-04-03 15:09:44 +02:00
parent ab030dce7f
commit d1e6f9c18d
@@ -45,10 +45,11 @@ namespace AutopilotMonitor.Functions.Functions.Reports
var tenantId = requestCtx.TenantId;
var userIdentifier = requestCtx.UserPrincipalName;
// Request body size limit (1 MB)
// Request body size limit (20 MB — must accommodate base64-encoded agent logs,
// screenshots, plus CSV/TXT exports; base64 adds ~33% overhead)
if (req.Headers.TryGetValues("Content-Length", out var clValues)
&& long.TryParse(clValues.FirstOrDefault(), out var contentLength)
&& contentLength > 1_048_576)
&& contentLength > 20_971_520)
{
var tooLarge = req.CreateResponse(HttpStatusCode.BadRequest);
await tooLarge.WriteAsJsonAsync(new { success = false, message = "Request body too large" });