fix(upload): stop large photo batches failing as "network error"#2
Merged
Conversation
A real gallery exceeds Werkzeug's 1000-part form limit and/or the byte cap. The dev server rejects an over-limit request before reading the body, so the browser (still uploading) sees the socket reset and reports a misleading "Network error - is the server running?" instead of a clean limit message. Raising the byte cap alone was whack-a-mole and never touched the separate 1000-part ceiling. - config: add MAX_UPLOAD_FILES (5000 local / 500 public, env-tunable) and raise MAX_FORM_PARTS above it (+ headroom) so a valid batch is never reset; expose the limits to the page. - frontend: pre-flight the batch size/count before uploading and show a clear, actionable message (with a Local Folder nudge) instead of a reset; parse the response defensively so an HTML error body is not mislabeled as a network error. - tests: cover the new limits, env override, public-mode tightening, and acceptance of a batch over the historical 1000-part ceiling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Uploading a real photo gallery failed with a red "Network error — is the server running?" toast right after clicking Start Sorting — even though the server was fine.
Root cause: a real gallery exceeds Werkzeug's 1000-part multipart limit and/or the byte cap. The dev server rejects an over-limit request before reading the body, so the browser (still uploading) sees the socket reset and
fetch()throws — surfacing as a misleading "network error" instead of a clean message. Raising the byte cap alone (a prior fix) was whack-a-mole and never touched the separate 1000-part ceiling.Fix
MAX_UPLOAD_FILES(5000 local / 500 public, env-tunable viaFACE_SORT_MAX_UPLOAD_FILES) and raiseMAX_FORM_PARTSjust above it so a valid batch is never reset; expose both limits to the page.Verification
pytest tests/→ 21 passed (6 new)node --checkclean onapp.js; template renders the injected limits.🤖 Generated with Claude Code