Skip to content

Commit 0cd5e46

Browse files
committed
add mothership read externsions
1 parent 13c4919 commit 0cd5e46

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

apps/sim/app/api/files/upload/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { generateWorkspaceFileKey } from '@/lib/uploads/contexts/workspace/works
88
import { isImageFileType } from '@/lib/uploads/utils/file-utils'
99
import {
1010
SUPPORTED_AUDIO_EXTENSIONS,
11+
SUPPORTED_CODE_EXTENSIONS,
1112
SUPPORTED_DOCUMENT_EXTENSIONS,
1213
SUPPORTED_VIDEO_EXTENSIONS,
1314
validateFileType,
@@ -23,6 +24,7 @@ const IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg'] as const
2324

2425
const ALLOWED_EXTENSIONS = new Set<string>([
2526
...SUPPORTED_DOCUMENT_EXTENSIONS,
27+
...SUPPORTED_CODE_EXTENSIONS,
2628
...IMAGE_EXTENSIONS,
2729
...SUPPORTED_AUDIO_EXTENSIONS,
2830
...SUPPORTED_VIDEO_EXTENSIONS,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
import {
4040
isSupportedExtension,
4141
SUPPORTED_AUDIO_EXTENSIONS,
42+
SUPPORTED_CODE_EXTENSIONS,
4243
SUPPORTED_DOCUMENT_EXTENSIONS,
4344
SUPPORTED_VIDEO_EXTENSIONS,
4445
} from '@/lib/uploads/utils/validation'
@@ -83,6 +84,7 @@ const logger = createLogger('Files')
8384

8485
const SUPPORTED_EXTENSIONS = [
8586
...SUPPORTED_DOCUMENT_EXTENSIONS,
87+
...SUPPORTED_CODE_EXTENSIONS,
8688
...SUPPORTED_AUDIO_EXTENSIONS,
8789
...SUPPORTED_VIDEO_EXTENSIONS,
8890
] as const

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,54 @@ export const SUPPORTED_DOCUMENT_EXTENSIONS = [
2929
'yml',
3030
] as const
3131

32+
export const SUPPORTED_CODE_EXTENSIONS = [
33+
'mdx',
34+
'xml',
35+
'css',
36+
'scss',
37+
'less',
38+
'js',
39+
'jsx',
40+
'ts',
41+
'tsx',
42+
'py',
43+
'rb',
44+
'go',
45+
'rs',
46+
'java',
47+
'kt',
48+
'swift',
49+
'c',
50+
'cpp',
51+
'h',
52+
'hpp',
53+
'cs',
54+
'php',
55+
'sh',
56+
'bash',
57+
'zsh',
58+
'fish',
59+
'sql',
60+
'graphql',
61+
'gql',
62+
'toml',
63+
'ini',
64+
'conf',
65+
'cfg',
66+
'env',
67+
'log',
68+
'diff',
69+
'patch',
70+
'dockerfile',
71+
'makefile',
72+
'gitignore',
73+
'editorconfig',
74+
'prettierrc',
75+
'eslintrc',
76+
] as const
77+
78+
export type SupportedCodeExtension = (typeof SUPPORTED_CODE_EXTENSIONS)[number]
79+
3280
export const SUPPORTED_AUDIO_EXTENSIONS = [
3381
'mp3',
3482
'm4a',

0 commit comments

Comments
 (0)