Skip to content

Commit 9ae656c

Browse files
fix(files): default file name (#3585)
1 parent c738226 commit 9ae656c

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ export async function POST(request: NextRequest) {
7474
const uploadResults = []
7575

7676
for (const file of files) {
77-
const originalName = file.name
78-
if (!originalName) {
79-
throw new InvalidRequestError('File name is missing')
80-
}
77+
const originalName = file.name || 'untitled'
8178

8279
if (!validateFileExtension(originalName)) {
8380
const extension = originalName.split('.').pop()?.toLowerCase() || 'unknown'

apps/sim/app/api/workspaces/[id]/files/route.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
9393
return NextResponse.json({ error: 'No file provided' }, { status: 400 })
9494
}
9595

96-
const fileName = rawFile.name
97-
if (!fileName) {
98-
return NextResponse.json({ error: 'File name is missing' }, { status: 400 })
99-
}
96+
const fileName = rawFile.name || 'untitled'
10097

10198
const maxSize = 100 * 1024 * 1024
10299
if (rawFile.size > maxSize) {

0 commit comments

Comments
 (0)