Fix upload crash with repeated file fields

The multipart middleware returns an array when a field is repeated, but handleUpload treats every value as one file. Flatten the values before moving them so repeated and unique field names both work.

Signed-off-by: Raymond (Kai) Tainaan <282025710+rtainaan@users.noreply.github.com>
This commit is contained in:
Raymond (Kai) Tainaan committed 2026-08-06 23:36:07 -07:00
1 parent 1b46d68027
commit 3f9afe57bc
1 file changed
+1 -1
+1 -1
View File
@@ -42,7 +42,7 @@ class MiscController {
return res.sendStatus(400)
}
const files = Object.values(req.files)
const files = Object.values(req.files).flat()
let { title, author, series, folder: folderId, library: libraryId } = req.body
// Validate request body
if (!libraryId || !folderId || typeof libraryId !== 'string' || typeof folderId !== 'string' || !title || typeof title !== 'string') {