fix: increase body limit to 10 GB to prevent upload truncation (#95)
Axum's default body limit for Multipart extraction is 2 MB. OxiCloud never overrode this default, so any file upload larger than ~2 MB was silently truncated. Added DefaultBodyLimit::max(10 GB) both globally on the app router and specifically on the file upload routes, matching the chunked upload capability already in place for large files.
This commit is contained in:
@@ -3,6 +3,7 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::Router;
|
||||
use axum::extract::DefaultBodyLimit;
|
||||
use tower_http::trace::TraceLayer;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
@@ -153,6 +154,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
use oxicloud::interfaces::middleware::redirect::redirect_middleware;
|
||||
app = app.layer(axum::middleware::from_fn(redirect_middleware));
|
||||
|
||||
// Increase the default body limit to 10 GB to allow large file uploads.
|
||||
// Without this Axum caps Multipart bodies at 2 MB.
|
||||
app = app.layer(DefaultBodyLimit::max(10 * 1024 * 1024 * 1024));
|
||||
|
||||
// Start server
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 8086));
|
||||
tracing::info!("Starting OxiCloud server on http://{}", addr);
|
||||
|
||||
Reference in New Issue
Block a user