Fix multipart upload failure: raise body limit and fix catch syntax
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
This commit is contained in:
parent
0431308cb4
commit
8c5450348a
2 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use axum::{
|
use axum::{
|
||||||
body::Body,
|
body::Body,
|
||||||
extract::{Multipart, Query, State},
|
extract::{DefaultBodyLimit, Multipart, Query, State},
|
||||||
http::{header, StatusCode},
|
http::{header, StatusCode},
|
||||||
response::{Html, Json, Response},
|
response::{Html, Json, Response},
|
||||||
routing::{get, post},
|
routing::{get, post},
|
||||||
|
|
@ -65,6 +65,7 @@ async fn main() {
|
||||||
.route("/upload", post(upload))
|
.route("/upload", post(upload))
|
||||||
.route("/download", get(download))
|
.route("/download", get(download))
|
||||||
.route("/reset", post(reset_session))
|
.route("/reset", post(reset_session))
|
||||||
|
.layer(DefaultBodyLimit::max(50 * 1024 * 1024)) // 50 MB – phone photos can be large
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
let addr = "0.0.0.0:3000";
|
let addr = "0.0.0.0:3000";
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
<script>
|
<script>
|
||||||
// Restore coords if iOS discarded the page while camera was open
|
// Restore coords if iOS discarded the page while camera was open
|
||||||
let gpsCoords = (() => {
|
let gpsCoords = (() => {
|
||||||
try { return JSON.parse(sessionStorage.getItem('gpsCoords')); } catch { return null; }
|
try { return JSON.parse(sessionStorage.getItem('gpsCoords')); } catch (e) { return null; }
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function getLocation() {
|
function getLocation() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue