This commit is contained in:
Vikhyath Mondreti
2026-02-03 15:58:51 -08:00
parent 5a78b55b1e
commit b7ccbc8cb9
2 changed files with 8 additions and 11 deletions

View File

@@ -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

View File

@@ -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) {