fix(upload): raise body-size limit to 512 MiB + surface upload errors
CI / Check (pull_request) Successful in 5m40s
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped

Artifact uploads (PLC .projectarchive, firmware images, mobile packages) larger
than axum's 2 MiB default request-body limit were rejected, and the wizard
swallowed the error (`let _ = upload_target_artifact`), so the target was created
with no artifact — every scan then showed "blocked, no artifact provided".

- agent: DefaultBodyLimit::max(512 MiB) on the API router (multipart upload route).
- dashboard: DefaultBodyLimit::max(512 MiB) on the axum app serving the upload
  server function (the browser→dashboard hop).
- wizard: surface upload failures in the error banner instead of ignoring them.

Found live: a 9.9 MB CODESYS .projectarchive failed to attach (a 1.7 KB .st worked).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-07-16 19:57:10 +02:00
co-authored by Claude Opus 4.8
parent 55e4117369
commit ee0efe5e22
3 changed files with 16 additions and 3 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
use std::sync::Arc;
use axum::extract::Request;
use axum::extract::{DefaultBodyLimit, Request};
use axum::http::HeaderValue;
use axum::middleware::Next;
use axum::response::Response;
@@ -74,6 +74,9 @@ pub async fn start_api_server(agent: ComplianceAgent, port: u16) -> Result<(), A
let mut app = routes::build_router()
.merge(admin_router)
// Allow large artifact uploads (PLC .projectarchive, firmware images,
// mobile packages) — axum's default request-body limit is only 2 MiB.
.layer(DefaultBodyLimit::max(512 * 1024 * 1024))
.layer(Extension(Arc::new(agent.clone())))
.layer(CorsLayer::permissive())
.layer(TraceLayer::new_for_http())