From d3d3deaa7aae49d6d949aebcba015af75d292ccc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Mar 2022 10:57:36 +0100 Subject: Refactor user build and express file middlewares --- server/helpers/express-utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts index 08f77966f..82dd4c178 100644 --- a/server/helpers/express-utils.ts +++ b/server/helpers/express-utils.ts @@ -68,11 +68,11 @@ function badRequest (_req: express.Request, res: express.Response) { function createReqFiles ( fieldNames: string[], mimeTypes: { [id: string]: string | string[] }, - destinations: { [fieldName: string]: string } + destination = CONFIG.STORAGE.TMP_DIR ): RequestHandler { const storage = diskStorage({ destination: (req, file, cb) => { - cb(null, destinations[file.fieldname]) + cb(null, destination) }, filename: (req, file, cb) => { @@ -93,12 +93,11 @@ function createReqFiles ( function createAnyReqFiles ( mimeTypes: { [id: string]: string | string[] }, - destinationDirectory: string, fileFilter: (req: express.Request, file: Express.Multer.File, cb: (err: Error, result: boolean) => void) => void ): RequestHandler { const storage = diskStorage({ destination: (req, file, cb) => { - cb(null, destinationDirectory) + cb(null, CONFIG.STORAGE.TMP_DIR) }, filename: (req, file, cb) => { -- cgit v1.2.3