@@ -4,7 +4,7 @@ import { z } from 'zod'
44import { checkInternalAuth } from '@/lib/auth/hybrid'
55import { generateRequestId } from '@/lib/core/utils/request'
66import { FileInputSchema } from '@/lib/uploads/utils/file-schemas'
7- import { processFilesToUserFiles } from '@/lib/uploads/utils/file-utils'
7+ import { processFilesToUserFiles , type RawFileInput } from '@/lib/uploads/utils/file-utils'
88import { downloadFileFromStorage } from '@/lib/uploads/utils/file-utils.server'
99
1010export const dynamic = 'force-dynamic'
@@ -58,7 +58,11 @@ export async function POST(request: NextRequest) {
5858 // Prefer UserFile input, fall back to legacy base64 string
5959 if ( validatedData . file ) {
6060 // Process UserFile input
61- const userFiles = processFilesToUserFiles ( [ validatedData . file ] , requestId , logger )
61+ const userFiles = processFilesToUserFiles (
62+ [ validatedData . file as RawFileInput ] ,
63+ requestId ,
64+ logger
65+ )
6266
6367 if ( userFiles . length === 0 ) {
6468 return NextResponse . json ( { success : false , error : 'Invalid file input' } , { status : 400 } )
@@ -103,7 +107,7 @@ export async function POST(request: NextRequest) {
103107 'Content-Type' : 'application/octet-stream' ,
104108 'Dropbox-API-Arg' : httpHeaderSafeJson ( dropboxApiArg ) ,
105109 } ,
106- body : fileBuffer ,
110+ body : new Uint8Array ( fileBuffer ) ,
107111 } )
108112
109113 const data = await response . json ( )
0 commit comments