fix(web): stream large album uploads to disk (busboy) instead of buffering

Manual import used request.formData(), which buffers the whole body and caps out
around ~15MB — a real FLAC album is hundreds of MB (Hollywood's Bleeding is
584MB), so it failed with "expected multipart form data". Now the multipart body
is STREAMED with busboy: each file pipes straight to a hidden .import-<uuid>
staging dir on the library filesystem, then the dir is atomically renamed into
place. No full-body buffering, no size cap. Cleaned up on any failure; guards
(400 missing fields/audio, 409 exists) unchanged. web 161 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-14 14:37:25 +02:00
parent a94ba97eee
commit ce628ca245
3 changed files with 112 additions and 51 deletions
+5 -3
View File
@@ -12,17 +12,19 @@
"db:dev": "prisma migrate dev"
},
"dependencies": {
"@prisma/client": "6.1.0",
"@types/busboy": "^1.5.4",
"busboy": "^1.6.0",
"next": "15.5.20",
"react": "19.0.0",
"react-dom": "19.0.0",
"@prisma/client": "6.1.0"
"react-dom": "19.0.0"
},
"devDependencies": {
"typescript": "5.7.2",
"@types/node": "22.10.2",
"@types/react": "19.0.1",
"@types/react-dom": "19.0.1",
"prisma": "6.1.0",
"typescript": "5.7.2",
"vitest": "2.1.8"
}
}