Skip to content

Commit 1969271

Browse files
committed
feat(files): allow image uploads in workspace files
1 parent 4bc6a17 commit 1969271

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/files.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
SUPPORTED_AUDIO_EXTENSIONS,
4444
SUPPORTED_CODE_EXTENSIONS,
4545
SUPPORTED_DOCUMENT_EXTENSIONS,
46+
SUPPORTED_IMAGE_EXTENSIONS,
4647
SUPPORTED_VIDEO_EXTENSIONS,
4748
} from '@/lib/uploads/utils/validation'
4849
import type {
@@ -89,6 +90,7 @@ const SUPPORTED_EXTENSIONS = [
8990
...SUPPORTED_CODE_EXTENSIONS,
9091
...SUPPORTED_AUDIO_EXTENSIONS,
9192
...SUPPORTED_VIDEO_EXTENSIONS,
93+
...SUPPORTED_IMAGE_EXTENSIONS,
9294
] as const
9395

9496
const ACCEPT_ATTR = SUPPORTED_EXTENSIONS.map((ext) => `.${ext}`).join(',')

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,26 @@ export const SUPPORTED_AUDIO_EXTENSIONS = [
9595

9696
export const SUPPORTED_VIDEO_EXTENSIONS = ['mp4', 'mov', 'avi', 'mkv', 'webm'] as const
9797

98+
export const SUPPORTED_IMAGE_EXTENSIONS = [
99+
'png',
100+
'jpg',
101+
'jpeg',
102+
'gif',
103+
'webp',
104+
'svg',
105+
'bmp',
106+
'tif',
107+
'tiff',
108+
'heic',
109+
'heif',
110+
'avif',
111+
'ico',
112+
] as const
113+
98114
export type SupportedDocumentExtension = (typeof SUPPORTED_DOCUMENT_EXTENSIONS)[number]
99115
export type SupportedAudioExtension = (typeof SUPPORTED_AUDIO_EXTENSIONS)[number]
100116
export type SupportedVideoExtension = (typeof SUPPORTED_VIDEO_EXTENSIONS)[number]
117+
export type SupportedImageExtension = (typeof SUPPORTED_IMAGE_EXTENSIONS)[number]
101118
export type SupportedMediaExtension =
102119
| SupportedDocumentExtension
103120
| SupportedAudioExtension
@@ -182,12 +199,10 @@ const SUPPORTED_IMAGE_MIME_TYPES = [
182199
'image/svg+xml',
183200
]
184201

185-
const SUPPORTED_IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg']
186-
187202
export const CHAT_ACCEPT_ATTRIBUTE = [
188203
ACCEPT_ATTRIBUTE,
189204
...SUPPORTED_IMAGE_MIME_TYPES,
190-
...SUPPORTED_IMAGE_EXTENSIONS,
205+
...SUPPORTED_IMAGE_EXTENSIONS.map((ext) => `.${ext}`),
191206
].join(',')
192207

193208
export interface FileValidationError {

0 commit comments

Comments
 (0)