mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 14:49:19 +00:00
优化
This commit is contained in:
parent
2c045183ac
commit
ebeba44f9d
@ -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));
|
||||||
|
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user