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:
Dionisio
2026-02-13 22:13:24 +01:00
parent aba7ea9d79
commit d889e325ac
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -2,6 +2,7 @@ use std::sync::Arc;
use axum::{
routing::{get, post, put, delete},
Router,
extract::DefaultBodyLimit,
response::Json as AxumJson,
};
use serde_json::json;
@@ -143,6 +144,7 @@ pub fn create_api_routes(app_state: &AppState) -> Router<AppState> {
.route("/upload", post(FileHandler::upload_file_with_thumbnails))
.route("/{id}", get(FileHandler::download_file))
.route("/{id}/thumbnail/{size}", get(FileHandler::get_thumbnail))
.layer(DefaultBodyLimit::max(10 * 1024 * 1024 * 1024)) // 10 GB for file uploads
.with_state(app_state.clone());
// File operations with trash support