refactor: strengthen upload boundary types

This commit is contained in:
Tom Boullay
2026-04-27 17:21:44 +02:00
parent d049318a73
commit fd586f4185
7 changed files with 96 additions and 39 deletions
+3 -5
View File
@@ -6,6 +6,7 @@ import { classifyFileChanges } from '@/lib/diff-files'
import { getModelFolderPath } from '@/lib/model-paths'
import { cleanupStagingUpload, ensurePreparedStagingAssets, readStagedManifest } from '@/lib/upload-staging'
import { acquireUploadLock, releaseUploadLock } from '@/lib/upload-lock'
import { parseStagingRequestBody } from '@/lib/upload-request'
export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'
@@ -23,11 +24,8 @@ export async function POST(req: NextRequest) {
let stagingId: string
try {
const body = await req.json()
stagingId = body.stagingId
if (!stagingId || typeof stagingId !== 'string') {
throw new Error('stagingId manquant')
}
const body: unknown = await req.json()
stagingId = parseStagingRequestBody(body).stagingId
const manifest = await readStagedManifest(stagingId)
folderName = manifest.folderName
} catch (err) {