mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-04 03:35:04 -05:00
fix
This commit is contained in:
@@ -79,10 +79,7 @@ export async function POST(request: NextRequest) {
|
||||
fileBuffer = Buffer.from(validatedData.fileContent, 'base64')
|
||||
fileName = validatedData.fileName || 'file'
|
||||
} else {
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'File or file content is required' },
|
||||
{ status: 400 }
|
||||
)
|
||||
return NextResponse.json({ success: false, error: 'File is required' }, { status: 400 })
|
||||
}
|
||||
|
||||
// Determine final path
|
||||
|
||||
@@ -318,13 +318,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
}
|
||||
|
||||
// Normalize file input for upload operation
|
||||
// normalizeFileInput handles JSON stringified values from advanced mode
|
||||
if (params.file) {
|
||||
params.file = normalizeFileInput(params.file, { single: true })
|
||||
}
|
||||
// Legacy: also check fileContent for backwards compatibility
|
||||
if (params.fileContent && !params.file) {
|
||||
params.fileContent = normalizeFileInput(params.fileContent, { single: true })
|
||||
// Check all possible field IDs: uploadFile (basic), fileRef (advanced), fileContent (legacy)
|
||||
const normalizedFile = normalizeFileInput(
|
||||
params.uploadFile || params.fileRef || params.fileContent,
|
||||
{ single: true }
|
||||
)
|
||||
if (normalizedFile) {
|
||||
params.file = normalizedFile
|
||||
}
|
||||
|
||||
switch (params.operation) {
|
||||
|
||||
Reference in New Issue
Block a user