diff --git a/controllers/convert.js b/controllers/convert.js index ab0d261..d750562 100644 --- a/controllers/convert.js +++ b/controllers/convert.js @@ -31,7 +31,7 @@ export const convert = async (req, res) => { .send("No 'files' field provided in request FormData.") ); - const { + let { files: { files }, // Multer stores all file fields in a "files" object, which is what cause the nesting. } = req; @@ -76,6 +76,8 @@ export const convert = async (req, res) => { ) ); + files = fileConverter.__transformFiles(files); + for (const { mimetype } of files) if (!moduleObject.convertsFrom(mimetype)) return await unlinkAndGo(req.files, () => @@ -141,11 +143,7 @@ export const convert = async (req, res) => { } } - const job = fileConverter.createJob( - fileConverter.__transformFiles(files), - moduleObject, - parsedOptions - ); + const job = fileConverter.createJob(files, moduleObject, parsedOptions); res.status(200).send({ jobId: job._id }); diff --git a/package.json b/package.json index 94c0b27..29cd2e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nottimtam/file-converter", - "version": "1.2.17", + "version": "1.2.18", "description": "A headless, self-hostable, open-source file conversion express middleware.", "main": "index.js", "type": "module",