fix(file-upload): workspace/chat context not being passed in some forms#1852
Merged
icecrasher321 merged 1 commit intostagingfrom Nov 8, 2025
Merged
fix(file-upload): workspace/chat context not being passed in some forms#1852icecrasher321 merged 1 commit intostagingfrom
icecrasher321 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR fixes a critical bug where the context parameter was missing from FormData uploads in fallback paths when presigned URLs are unavailable. The /api/files/upload endpoint requires an explicit context parameter to determine proper file storage routing and permissions.
Key Changes:
- Added
context: 'chat'to FormData inuse-image-upload.ts(chat deploy hook) - Added
context: 'chat'to FormData inimage-selector.tsx(chat logo selector) - Added
context: 'workspace'to FormData infile-upload.tsx(workflow block file uploads)
Impact:
- Without this fix, fallback uploads would fail with error: "Upload requires explicit context parameter"
- The primary presigned URL path already correctly passes
type=chatquery parameter, so this only affects the fallback scenario - Ensures consistent storage routing for both direct uploads and API fallback uploads
Confidence Score: 5/5
- This PR is safe to merge with no risk
- The changes are minimal, focused, and fix a clear bug. Each addition correctly matches the required context for the specific upload scenario (chat vs workspace). The fix aligns with the existing codebase pattern where other upload locations already include the context parameter. No logical errors, security issues, or unintended side effects were found.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/deploy-modal/components/chat-deploy/hooks/use-image-upload.ts | 5/5 | Added missing context: 'chat' parameter to FormData for fallback upload path, ensuring proper file storage routing |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/deploy-modal/components/image-selector/image-selector.tsx | 5/5 | Added missing context: 'chat' parameter to FormData for fallback upload path, ensuring proper file storage routing |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/file-upload.tsx | 5/5 | Added missing context: 'workspace' parameter to FormData for file uploads, ensuring proper file storage routing with workspace-scoped storage |
Sequence Diagram
sequenceDiagram
participant User
participant ImageUpload as Image Upload Component
participant Presigned as /api/files/presigned
participant CloudStorage as Cloud Storage
participant Upload as /api/files/upload
participant Storage as Storage Service
User->>ImageUpload: Select/Upload Image
Note over ImageUpload,Presigned: Primary Path: Direct Upload
ImageUpload->>Presigned: POST with type=chat/workspace
alt Cloud Storage Available
Presigned-->>ImageUpload: Presigned URL + key
ImageUpload->>CloudStorage: PUT file to presigned URL
CloudStorage-->>ImageUpload: Upload success
else No Cloud Storage / Presigned Fails
Note over ImageUpload,Upload: Fallback Path (Fixed in this PR)
ImageUpload->>Upload: POST with FormData
Note right of ImageUpload: BEFORE: Missing context<br/>AFTER: Includes context='chat'/'workspace'
Upload->>Upload: Validate context parameter (required)
Upload->>Storage: Upload with context
Storage-->>Upload: File info with path
Upload-->>ImageUpload: Success response
end
ImageUpload-->>User: Display uploaded image
3 files reviewed, no comments
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 9, 2025
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pass storage context in form based callsites correctly.
Type of Change
Testing
Tested with @aadamgough
Checklist