fix: include file extensions in client accept filters - #1289
Conversation
Some browsers (Chrome on Windows) ignore MIME-only accept values like application/java-archive. Emit known extensions from mime-types so the native file picker can filter correctly. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: b38d1f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@armancharan is attempting to deploy a commit to the Ping Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. WalkthroughThe shared upload utilities now resolve known file extensions from MIME types. Client accept mappings include those extensions for file-picker filters. Tests cover Java archives, PDFs, accept attributes, and ChangesMIME extension filters
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR adds known file extensions to client accept filters to improve Windows Chrome file selection while preserving existing MIME-based behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Confidence Score: 4/5The extension-filtering fix should be completed for supported MIME families outside the five imported tables before merging. Raw supported MIME values such as font or model types bypass extension resolution because the lookup excludes the vendored miscellaneous MIME table, preserving the Windows file-picker failure for those routes. Files Needing Attention: packages/shared/src/component-utils.ts Important Files Changed
Prompt To Fix All With AI### Issue 1
packages/shared/src/component-utils.ts:30-36
**Extension lookup omits MIME families**
When a route uses a supported MIME type from the vendored `misc` table, such as `font/woff2` or `model/obj`, `extensionsForMime` returns no extension because `mimeTables` excludes that table, causing Windows Chrome to retain the MIME-only picker behavior this change is intended to fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix: include file extensions in client a..." | Re-trigger Greptile |
| const mimeTables: Array<Record<string, { extensions: readonly string[] }>> = [ | ||
| application, | ||
| audio, | ||
| image, | ||
| text, | ||
| video, | ||
| ]; |
There was a problem hiding this comment.
Extension lookup omits MIME families
When a route uses a supported MIME type from the vendored misc table, such as font/woff2 or model/obj, extensionsForMime returns no extension because mimeTables excludes that table, causing Windows Chrome to retain the MIME-only picker behavior this change is intended to fix.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/shared/src/component-utils.ts
Line: 30-36
Comment:
**Extension lookup omits MIME families**
When a route uses a supported MIME type from the vendored `misc` table, such as `font/woff2` or `model/obj`, `extensionsForMime` returns no extension because `mimeTables` excludes that table, causing Windows Chrome to retain the MIME-only picker behavior this change is intended to fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
generateMimeTypesandgenerateClientDropzoneAcceptnow emit known file extensions alongside MIME types (e.g..jarforapplication/java-archive)acceptvalues and falls back to "All Files"Test plan
bun run --filter @uploadthing/shared testbun run --filter @uploadthing/shared typecheckbun run --filter @uploadthing/shared lint'application/java-archive'and confirm the file picker filters to.jarfilesMade with Cursor
Summary by CodeRabbit
Bug Fixes
Tests