Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Written by Cursor Bugbot for commit 85290b2. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| const originalName = file.name | ||
| if (!originalName) { | ||
| throw new InvalidRequestError('File name is missing') | ||
| } |
There was a problem hiding this comment.
Default filename 'untitled' always fails extension validation
High Severity
The default filename 'untitled' has no file extension, so validateFileExtension('untitled') will always return false — it splits on '.', gets 'untitled' as the "extension", and that's not in ALLOWED_EXTENSIONS. This means when a file has no name (the exact scenario this PR is fixing), the upload is rejected with a confusing error: "File type 'untitled' is not allowed" instead of proceeding with the default name. The previous behavior at least gave a clear "File name is missing" error. The workspace files route doesn't have this problem since it has no extension check.
Greptile SummaryThis PR attempts to fix a bug where missing file names in non-local (cloud) environments caused file uploads to fail with hard errors. The approach replaces the strict validation with a
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant UploadRoute as /api/files/upload
participant WorkspaceRoute as /api/workspaces/[id]/files
Client->>UploadRoute: POST multipart/form-data (file, context)
UploadRoute->>UploadRoute: file.name || 'untitled'
UploadRoute->>UploadRoute: validateFileExtension('untitled')
note over UploadRoute: Returns false — 'untitled' has no<br/>recognised extension
UploadRoute-->>Client: 400 "File type 'untitled' is not allowed"
Client->>WorkspaceRoute: POST multipart/form-data (file)
WorkspaceRoute->>WorkspaceRoute: rawFile.name || 'untitled'
note over WorkspaceRoute: No extension validation here
WorkspaceRoute->>WorkspaceRoute: uploadWorkspaceFile(..., 'untitled', ...)
WorkspaceRoute-->>Client: 200 { success: true, file: userFile }
|


Summary
Default filename not being passed through in non-local environments.
Type of Change
Testing
Tested manually
Checklist