fix(upload): raise body-size limit to 512 MiB + surface upload errors (#177)
CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 3m33s
CI / Deploy Dashboard (push) Successful in 2m39s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Has been skipped
CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 3m33s
CI / Deploy Dashboard (push) Successful in 2m39s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Has been skipped
This commit was merged in pull request #177.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use axum::extract::Request;
|
use axum::extract::{DefaultBodyLimit, Request};
|
||||||
use axum::http::HeaderValue;
|
use axum::http::HeaderValue;
|
||||||
use axum::middleware::Next;
|
use axum::middleware::Next;
|
||||||
use axum::response::Response;
|
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()
|
let mut app = routes::build_router()
|
||||||
.merge(admin_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(Extension(Arc::new(agent.clone())))
|
||||||
.layer(CorsLayer::permissive())
|
.layer(CorsLayer::permissive())
|
||||||
.layer(TraceLayer::new_for_http())
|
.layer(TraceLayer::new_for_http())
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use axum::extract::DefaultBodyLimit;
|
||||||
use axum::routing::{get, post};
|
use axum::routing::{get, post};
|
||||||
use axum::{middleware, Extension};
|
use axum::{middleware, Extension};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
@@ -66,6 +67,9 @@ pub fn server_start(app: fn() -> Element) -> Result<(), DashboardError> {
|
|||||||
// Webhook proxy: forward to agent (no auth required)
|
// Webhook proxy: forward to agent (no auth required)
|
||||||
.route("/webhook/{platform}/{repo_id}", post(webhook_proxy))
|
.route("/webhook/{platform}/{repo_id}", post(webhook_proxy))
|
||||||
.serve_dioxus_application(ServeConfig::new(), app)
|
.serve_dioxus_application(ServeConfig::new(), app)
|
||||||
|
// Allow large artifact uploads through the upload server function
|
||||||
|
// (PLC .projectarchive, firmware, mobile) — default is 2 MiB.
|
||||||
|
.layer(DefaultBodyLimit::max(512 * 1024 * 1024))
|
||||||
.layer(Extension(PendingOAuthStore::default()))
|
.layer(Extension(PendingOAuthStore::default()))
|
||||||
.layer(middleware::from_fn(require_auth))
|
.layer(middleware::from_fn(require_auth))
|
||||||
.layer(Extension(server_state))
|
.layer(Extension(server_state))
|
||||||
|
|||||||
@@ -520,14 +520,20 @@ pub fn OnboardingPage() -> Element {
|
|||||||
created_id.set(Some(id.clone()));
|
created_id.set(Some(id.clone()));
|
||||||
// Upload staged file artifacts now that the target exists.
|
// Upload staged file artifacts now that the target exists.
|
||||||
for pf in files {
|
for pf in files {
|
||||||
let _ = upload_target_artifact(
|
let fname = pf.filename.clone();
|
||||||
|
if let Err(e) = upload_target_artifact(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
pf.kind,
|
pf.kind,
|
||||||
pf.plc_format,
|
pf.plc_format,
|
||||||
pf.filename,
|
pf.filename,
|
||||||
pf.bytes,
|
pf.bytes,
|
||||||
)
|
)
|
||||||
.await;
|
.await
|
||||||
|
{
|
||||||
|
error.set(Some(format!(
|
||||||
|
"Upload failed for {fname}: {e}"
|
||||||
|
)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if let Ok(sc) = fetch_applicable_scans(id.clone()).await {
|
if let Ok(sc) = fetch_applicable_scans(id.clone()).await {
|
||||||
scans.set(sc.data.scans);
|
scans.set(sc.data.scans);
|
||||||
|
|||||||
Reference in New Issue
Block a user