Skip to content

Commit

Permalink
feat: 上传文件不做类型限制;项目文件file_type长度修改为120;
Browse files Browse the repository at this point in the history
上传文件不做类型限制;项目文件file_type长度修改为120;
  • Loading branch information
Imfdj_lt committed Sep 3, 2021
1 parent 5d5c29b commit 8fe36da
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/contract/request/project_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const body = {
type: 'string',
required: false,
min: 1,
max: 60,
max: 120,
trim: true,
example: '',
description: '文件类型',
Expand Down
4 changes: 2 additions & 2 deletions app/controller/v1/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class RoleController extends Controller {
});
return;
}
if (/^video\/.*$/i.test(stream.mimeType) && size > 50 * 1024 * 1024) {
if (/^video\/.*$/i.test(stream.mimeType) && size > 20 * 1024 * 1024) {
ctx.helper.body.INVALID_REQUEST({
ctx,
msg: '媒体文件容量不可超过50Mb',
msg: '媒体文件容量不可超过20Mb',
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/model/project_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = app => {
filename: Sequelize.STRING(50),
path: Sequelize.STRING(225),
extension: Sequelize.STRING(30),
file_type: Sequelize.STRING(60),
file_type: Sequelize.STRING(120),
size: Sequelize.INTEGER(11),
downloads: Sequelize.INTEGER(11),
is_recycle: Sequelize.TINYINT(1),
Expand Down
9 changes: 8 additions & 1 deletion config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ module.exports = appInfo => {
};

config.multipart = {
fileSize: '200mb',
fileSize: '20mb',
// fileExtensions: [
// '.docx',
// '.doc',
// '.xls',
// '.xlsx',
// ],
whitelist: filename => true, // 不做类型限制
};

config.sentry = {
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/20200110080210-create-project_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = {
comment: '文件扩展名',
},
file_type: {
type: Sequelize.STRING(60),
type: Sequelize.STRING(120),
allowNull: false,
defaultValue: '',
comment: '文件类型',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ module.exports = {
{
name: 'file_type',
type: 'string',
length: 60,
max: 60,
length: 120,
max: 120,
min: 1,
trim: true,
required: false,
Expand Down

0 comments on commit 8fe36da

Please sign in to comment.