fix(files): align upload route image extensions with picker#4423
fix(files): align upload route image extensions with picker#4423waleedlatif1 merged 7 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Tightens image-only context validation ( Extends Reviewed by Cursor Bugbot for commit 6abf6c2. Configure here. |
Greptile SummaryThis PR replaces the stale local Confidence Score: 5/5Safe to merge — all previously identified P1 bugs are resolved and no new defects were introduced The two confirmed P1 issues from prior review rounds are both correctly addressed. The only remaining finding is a P2 style concern about constant declaration order. No security issues, no broken code paths. No files require special attention beyond the P2 style suggestion in file-utils.ts Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[POST /api/files/upload] --> B{validateFileExtension\nSUPPORTED_IMAGE_EXTENSIONS}
B -- fails --> Z1[400 File type not allowed]
B -- passes --> C{context?}
C -- copilot --> E[Skip MIME check]
C -- chat / profile-pictures\nworkspace-logos --> D{isGenericMime?}
D -- yes octet-stream or empty --> F[extensionIsImage check\nvs SUPPORTED_IMAGE_EXTENSIONS]
D -- no specific MIME --> G[isImageFileType MIME check\nvs MIME_TYPE_MAPPING]
F -- false --> Z2[400 Only image files allowed]
G -- false --> Z2
F -- true --> E
G -- true --> E
E --> H[resolveFileType\nbrowser MIME → extension fallback]
H --> I[storageService.uploadFile\nwith resolvedContentType]
I --> J[Return fileInfo with resolvedContentType]
Reviews (6): Last reviewed commit: "fix(files): cover image/jpg in Claude ga..." | Re-trigger Greptile |
|
@greptile-apps Good catch on the secondary MIME gate — fixed in 09618ed. Added the new image MIME types ( |
|
@greptile |
|
@cursor review |
|
The fix looks correct. The 7 new MIME types are properly added to const IMAGE_MIME_TYPES = new Set(
Object.entries(MIME_TYPE_MAPPING)
.filter(([, v]) => v === 'image')
.map(([k]) => k)
)... One minor gap worth being aware of: LGTM overall. |
…y uploads Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7377716. Configure here.
|
@greptile |
|
@cursor review |
… generic Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@cursor review |
|
@greptile |
…etadata Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6abf6c2. Configure here.
Summary
/api/files/uploadhad a stale localIMAGE_EXTENSIONS = ['png','jpg','jpeg','gif','webp','svg']that didn't match the new exportedSUPPORTED_IMAGE_EXTENSIONS(which adds bmp/tif/tiff/heic/heif/avif/ico)SUPPORTED_IMAGE_EXTENSIONSso the upload route accepts the same set the picker offersType of Change
Testing
Tested manually
Checklist