From ebeba44f9dd985710f6f5fac5282fa3e9a2d53e5 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 14 May 2025 13:06:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 3 ++- src/modules/public/file.controller.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 83cdb2f..f3ce149 100644 --- a/src/app.ts +++ b/src/app.ts @@ -17,13 +17,14 @@ const apps = { app.use((req, res, next) => { const contentType = req.headers['content-type'] || ''; if (contentType.includes('multipart/form-data')) { + logger.debug('检测到form-data数据流,跳过加载 express.json() 中间件..'); next(); } else { express.json()(req, res, next); } }); app.use(compression()); - logger.debug('成功加载 express.json() 中间件'); + logger.debug('成功加载 express.json() 中间件..'); const publicPath = paths.get('public'); app.use('/public', express.static(publicPath)); diff --git a/src/modules/public/file.controller.ts b/src/modules/public/file.controller.ts index 5a1bba3..244fa65 100644 --- a/src/modules/public/file.controller.ts +++ b/src/modules/public/file.controller.ts @@ -86,6 +86,7 @@ class FileController { return; } + logger.debug(`检测到上传文件..`); const uploadDir = req.query.dir?.toString() || ''; const deleteAfter = parseInt(req.query.expire as string) || 10 * 60; const { fullPath, relativePath } = await this.FileService.saveUploadedFile(