return res.type('json').status(400).end()
}
-function createReqFiles (fieldName: string, storageDir: string, mimeTypes: { [ id: string ]: string }) {
+function createReqFiles (
+ fieldNames: string[],
+ mimeTypes: { [ id: string ]: string },
+ destinations: { [ fieldName: string ]: string }
+) {
const storage = multer.diskStorage({
destination: (req, file, cb) => {
- cb(null, storageDir)
+ cb(null, destinations[file.fieldname])
},
filename: async (req, file, cb) => {
}
})
- return multer({ storage }).fields([{ name: fieldName, maxCount: 1 }])
+ const fields = []
+ for (const fieldName of fieldNames) {
+ fields.push({
+ name: fieldName,
+ maxCount: 1
+ })
+ }
+
+ return multer({ storage }).fields(fields)
}
async function generateRandomString (size: number) {
]
for (const resolution of resolutions) {
- if (configResolutions[resolution.toString()] === true && videoFileHeight > resolution) {
+ if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) {
resolutionsEnabled.push(resolution)
}
}