From 8c5450348acb05efe79b56937a1c2f2c9145984a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 20:47:44 +0000 Subject: [PATCH] Fix multipart upload failure: raise body limit and fix catch syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Axum 0.7 defaults to a 2 MB body limit, which rejects typical phone photos (often 5–15 MB). Added DefaultBodyLimit::max(50 MB) to accept large images. Also changed `catch {}` to `catch (e) {}` in the sessionStorage IIFE; the optional-catch-binding syntax (ES2019) is not supported by all mobile WebViews, which would have prevented the script from loading entirely. https://claude.ai/code/session_015myTTMs6yDsAGarATe5ePZ --- src/main.rs | 3 ++- templates/index.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f97f1a8..da8e8fb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use axum::{ body::Body, - extract::{Multipart, Query, State}, + extract::{DefaultBodyLimit, Multipart, Query, State}, http::{header, StatusCode}, response::{Html, Json, Response}, routing::{get, post}, @@ -65,6 +65,7 @@ async fn main() { .route("/upload", post(upload)) .route("/download", get(download)) .route("/reset", post(reset_session)) + .layer(DefaultBodyLimit::max(50 * 1024 * 1024)) // 50 MB – phone photos can be large .with_state(state); let addr = "0.0.0.0:3000"; diff --git a/templates/index.html b/templates/index.html index 3b9629f..59d6d57 100644 --- a/templates/index.html +++ b/templates/index.html @@ -158,7 +158,7 @@