Repository navigation
fix(composer): say a file is too large before uploading it - #446
Conversation
A file over the 8 MB attachment limit was read whole, encoded and sent, and the answer was shown as it came: "/api/pane/image failed (413): file exceeds 8388608 bytes", or nothing after the colon for a file past about 96 MB, which Bun's 128 MB request limit refuses before the route runs. uploadPaneImage checks the size first and throws AttachmentTooLargeError, whose message names the file, its size and the limit in the UI language. The composer and the terminal's drop and paste already show the error's message. A batch dropped on the terminal with one file too large uploads none of it, since its paths are pasted together. The limit moves to shared/attachments.ts so the browser and POST /api/pane/image use one number.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe client and server now use a shared 8 MiB attachment limit. The client reports oversized files before upload and validates every file in a batch before uploading any. The guide, changelog, tests, and translations reflect these changes. ChangesAttachment size validation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change shows a clear message for oversized attachments before uploading them, using the same 8 MB limit as the server. No merge-blocking risk was identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Early validation reduces unnecessary uploads without replacing server-side enforcement. No introduced security issue was established, but verification of the complete before-and-after behavior remains incomplete. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Bumps package.json and herdr-plugin.toml to 0.3.50 and moves the Unreleased notes under [0.3.50] - 2026-10-06, with the compare link. Adds the PR link and credit the #471 entry was missing; every other entry already carries them. Raises the remote PC bundle to 17: #470 changes the prompt answer route on the bridge, so a remote PC on bundle 16 keeps the old behaviour until its bridge is updated. Push the `remote-v17` tag and let the bundle workflow publish before running release.yml. Known limits carried into the notes: Japanese and Chinese text uses the device's fonts beside Pretendard; #469 stays open for what #470 does not cover (answers after the first committing key, identical twin prompts, screens no reader knows). Carries #422 #423 #424 #425 #426 #435 #437 #439 #446 #447 #448 #452 #454 #455 #456 #457 #458 #459 #460 #461 #462 #463 #465 #466 #467 #468 #471 #473 #474 #475 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <[email protected]>
Change
A file over the 8 MB attachment limit was read whole, encoded and uploaded, and then the server's answer was shown as it came:
/api/pane/image failed (413): file exceeds 8388608 bytes. For a 107 MB zip the message ended at the colon: the body (base64 in JSON, 142.7 MB) is past Bun's default 128 MB request limit, which answers 413 with an empty body before the route runs.Now the browser checks the size before it reads the file:
uploadPaneImagethrowsAttachmentTooLargeError, and nothing is sent. Its message is the text shown, in the UI language:Too large to attach: site.zip (9.3 MB). A file can be up to 8 MB.The composer and the terminal's drop and paste already show an upload error's message, so both get it.shared/attachments.ts, so the browser andPOST /api/pane/imageuse one number. The server's check and its 413 are unchanged.The limit itself is not changed here; #445 is about raising it.
Validation
bun run typecheck,bun run build,bun run generate:types --checkandbun run test:unitpass.src/lib/api.test.ts: a file one byte over the limit is refused with no request made, and a file at the limit is sent. With the check removed fromuploadPaneImagethe test fails (the upload goes out and returns a path).site.zip:Too large to attach: site.zip (9.3 MB). A file can be up to 8 MB.; no request to/api/pane/image.첨부하기에는 너무 큽니다: site.zip (9.3 MB). 파일은 8 MB까지 첨부할 수 있습니다., wrapped on two lines under the box; no request.notes.txtandsite.ziptogether: the same sentence in the terminal's notice; no request.notes.txtattached in the composer is uploaded (200) and saved under the pane's.herdr-web-ui/.