This commit is contained in:
Jerry 2025-05-14 13:06:16 +08:00
parent 2c045183ac
commit ebeba44f9d
2 changed files with 3 additions and 1 deletions

View File

@ -17,13 +17,14 @@ const apps = {
app.use((req, res, next) => { app.use((req, res, next) => {
const contentType = req.headers['content-type'] || ''; const contentType = req.headers['content-type'] || '';
if (contentType.includes('multipart/form-data')) { if (contentType.includes('multipart/form-data')) {
logger.debug('检测到form-data数据流,跳过加载 express.json() 中间件..');
next(); next();
} else { } else {
express.json()(req, res, next); express.json()(req, res, next);
} }
}); });
app.use(compression()); app.use(compression());
logger.debug('成功加载 express.json() 中间件'); logger.debug('成功加载 express.json() 中间件..');
const publicPath = paths.get('public'); const publicPath = paths.get('public');
app.use('/public', express.static(publicPath)); app.use('/public', express.static(publicPath));

View File

@ -86,6 +86,7 @@ class FileController {
return; return;
} }
logger.debug(`检测到上传文件..`);
const uploadDir = req.query.dir?.toString() || ''; const uploadDir = req.query.dir?.toString() || '';
const deleteAfter = parseInt(req.query.expire as string) || 10 * 60; const deleteAfter = parseInt(req.query.expire as string) || 10 * 60;
const { fullPath, relativePath } = await this.FileService.saveUploadedFile( const { fullPath, relativePath } = await this.FileService.saveUploadedFile(