From b9482e9c4111ffcad674e5f9c44b6b0fdcb24d2f Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sat, 11 Jul 2020 11:19:39 +0200 Subject: [PATCH] Use new FileUploadMiddleware --- src/controllers/FileController.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controllers/FileController.ts b/src/controllers/FileController.ts index 56e3fc7..7a0ff66 100644 --- a/src/controllers/FileController.ts +++ b/src/controllers/FileController.ts @@ -7,9 +7,9 @@ import config from "config"; import * as fs from "fs"; import AuthToken from "../models/AuthToken"; import {IncomingForm} from "formidable"; -import {FILE_UPLOAD_MIDDLEWARE} from "wms-core/components/ExpressAppComponent"; import generateSlug from "../SlugGenerator"; import Logger from "wms-core/Logger"; +import FileUploadMiddleware from "wms-core/FileUploadMiddleware"; export default class FileController extends Controller { @@ -122,8 +122,7 @@ export default class FileController extends Controller { } } - -export const FILE_UPLOAD_FORM_MIDDLEWARE = FILE_UPLOAD_MIDDLEWARE(() => { +export const FILE_UPLOAD_FORM_MIDDLEWARE = new FileUploadMiddleware(() => { const form = new IncomingForm(); form.uploadDir = 'storage/tmp'; form.maxFileSize = config.get('max_upload_size') * 1024 * 1024;