Skip to content

fix: align upload client MIME types with server allow-list#823

Merged
miurla merged 1 commit intomainfrom
fix/upload-allowed-types-mismatch
Apr 15, 2026
Merged

fix: align upload client MIME types with server allow-list#823
miurla merged 1 commit intomainfrom
fix/upload-allowed-types-mismatch

Conversation

@miurla
Copy link
Copy Markdown
Owner

@miurla miurla commented Apr 15, 2026

Summary

  • The file upload button accepted image/gif, image/webp, .doc, and .docx, but app/api/upload/route.ts only allows image/jpeg, image/png, and application/pdf.
  • Users could pick a Word doc from the file picker, pass client validation, and then hit a 400 Unsupported file type on the server — surfaced as a generic "Failed to upload" toast.
  • Narrow the client allow-list (allowedImageTypes, allowedOtherTypes, <input accept>) to PNG/JPEG/PDF so unsupported files are rejected up front with the "Some files were not accepted" toast.

Fixes #822.

Test plan

  • Open the chat panel as an authenticated user and click the paperclip button — file picker only offers PNG/JPEG/PDF.
  • Drag-and-drop a .docx onto the input — "Some files were not accepted" toast appears, no network request to /api/upload.
  • Upload a PNG and a PDF — both succeed end-to-end.

The file upload button accepted Word docs, GIFs, and WebP images, but
the server's /api/upload route only allows PNG, JPEG, and PDF. Selecting
a Word doc therefore passed client validation and failed server-side
with a generic "Failed to upload" toast (#822).

Narrow client accept list to PNG/JPEG/PDF to match the server.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

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

Project Deployment Actions Updated (UTC)
morphic Ready Ready Preview, Comment Apr 15, 2026 2:29am

@miurla miurla merged commit 8db7272 into main Apr 15, 2026
8 checks passed
@miurla miurla deleted the fix/upload-allowed-types-mismatch branch April 15, 2026 02:31
@miurla miurla mentioned this pull request Apr 15, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Files not uploading

1 participant