mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-17 14:21:17 +01:00
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:
1 parent
1b46d68027
commit
3f9afe57bc
1 file changed
+1
-1
@@ -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') {
|
||||
|
||||
Reference in new issue
Block a user