fix(frontend): send drive uploads as multipart instead of JSON - #5625
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe drive media upload request now sets ChangesDrive media upload
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Railway Preview Environment
Updated at 2026-08-01T18:17:16.219Z |
Every upload through the Files drawer (the upload button, file drops, the
staged-files inbox) failed with 422 'Field required: file': uploadMountFile
posts its FormData through the shared axios instance, whose default
application/json content type makes axios JSON-serialize the FormData and
collapse the File to {}. The explicit multipart header fixes all of them. The
surface shipped dark, which is why nobody hit it before the flag came on.
Claude-Session: https://claude.ai/code/session_01A1XQVjHPYJgVBHWSNUphtx
22c06ca to
342dd2d
Compare
Dragging a file (or using the Upload button, or committing staged files) in the agent chat's Files drawer fails with 422
{"detail":[{"type":"missing","loc":["body","file"],"msg":"Field required"}]}. The request goes out asContent-Type: application/jsonwith body{"file":{}}.Before:
uploadMountFileposts its FormData through the shared axios instance, whose defaultapplication/jsoncontent type makes axios 1.x JSON-serialize the FormData (formDataToJSON), collapsing theFileto an empty object. Every upload affordance in the drawer funnels into this one helper, so all of them fail. The surface shipped dark behindNEXT_PUBLIC_AGENT_FILE_UPLOADS, which is why nobody hit it until the flag came on in dev.After: the post carries an explicit
Content-Type: multipart/form-data, the same fix and comment the composer's attachment transport uses for the identical trap.Verified against v0.106.2/main: the reworked drawer still funnels into this unchanged helper, so the one-line fix applies cleanly.
Not fixed here, filed separately: dropping a folder additionally arrives as a single zero-byte pseudo-file because the drop handlers read
dataTransfer.fileswith no directory enumeration; that fix needs authoring against the reworked drawer on main.https://claude.ai/code/session_01A1XQVjHPYJgVBHWSNUphtx