Skip to content

fix(frontend): send drive uploads as multipart instead of JSON - #5625

Merged
mmabrouk merged 1 commit into
release/v0.107.0from
fix/drive-upload-multipart
Aug 1, 2026
Merged

fix(frontend): send drive uploads as multipart instead of JSON#5625
mmabrouk merged 1 commit into
release/v0.107.0from
fix/drive-upload-multipart

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Aug 1, 2026

Copy link
Copy Markdown
Member

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 as Content-Type: application/json with body {"file":{}}.

Before: uploadMountFile posts its FormData through the shared axios instance, whose default application/json content type makes axios 1.x JSON-serialize the FormData (formDataToJSON), collapsing the File to an empty object. Every upload affordance in the drawer funnels into this one helper, so all of them fail. The surface shipped dark behind NEXT_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.files with no directory enumeration; that fix needs authoring against the reworked drawer on main.

https://claude.ai/code/session_01A1XQVjHPYJgVBHWSNUphtx

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 1, 2026
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 1, 2026 4:48pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ca0617e-d151-4473-a1e1-2f079cf4d54b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed file uploads from mounted drives by ensuring multipart form data is transmitted correctly.

Walkthrough

The drive media upload request now sets multipart/form-data explicitly. This prevents the shared JSON content type from handling the FormData payload incorrectly.

Changes

Drive media upload

Layer / File(s) Summary
Multipart upload request
web/oss/src/components/Drives/driveMedia.ts
uploadMountFile now declares the multipart/form-data content type in its Axios request.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: sending frontend drive uploads as multipart instead of JSON.
Description check ✅ Passed The description directly explains the upload failure, root cause, fix, verification, and folder-drop scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drive-upload-multipart

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

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
@mmabrouk
mmabrouk force-pushed the fix/drive-upload-multipart branch from 22c06ca to 342dd2d Compare August 1, 2026 16:46
@mmabrouk
mmabrouk merged commit d3fd008 into release/v0.107.0 Aug 1, 2026
39 of 40 checks passed
@mmabrouk
mmabrouk deleted the fix/drive-upload-multipart branch August 1, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Frontend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant