Skip to content

Commit ab939eb

Browse files
waleedlatif1claude
andcommitted
fix: replace image/* wildcard with explicit supported types in file picker
The image/* accept attribute allowed users to select BMP, TIFF, HEIC, and other image types that are rejected server-side. Replace with the exact set of supported image MIME types and extensions to match the copilot upload validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e0af69c commit ab939eb

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

apps/sim/lib/uploads/utils/validation.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,21 @@ export const ACCEPTED_FILE_EXTENSIONS = SUPPORTED_DOCUMENT_EXTENSIONS.map((ext)
111111

112112
export const ACCEPT_ATTRIBUTE = [...ACCEPTED_FILE_TYPES, ...ACCEPTED_FILE_EXTENSIONS].join(',')
113113

114-
export const CHAT_ACCEPT_ATTRIBUTE = [ACCEPT_ATTRIBUTE, 'image/*'].join(',')
114+
const SUPPORTED_IMAGE_MIME_TYPES = [
115+
'image/jpeg',
116+
'image/png',
117+
'image/gif',
118+
'image/webp',
119+
'image/svg+xml',
120+
]
121+
122+
const SUPPORTED_IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg']
123+
124+
export const CHAT_ACCEPT_ATTRIBUTE = [
125+
ACCEPT_ATTRIBUTE,
126+
...SUPPORTED_IMAGE_MIME_TYPES,
127+
...SUPPORTED_IMAGE_EXTENSIONS,
128+
].join(',')
115129

116130
export interface FileValidationError {
117131
code: 'UNSUPPORTED_FILE_TYPE' | 'MIME_TYPE_MISMATCH'

0 commit comments

Comments
 (0)