Skip to content

Commit

Permalink
Merge pull request #352 from kaola-fed/hotfix_upload_accept
Browse files Browse the repository at this point in the history
misc: 更新文件类型识别
  • Loading branch information
nupthale authored Apr 16, 2018
2 parents f7af961 + ad9ae3a commit 2d9782c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ const UploadBase = Component.extend({
Object.keys(typeMap).forEach((key) => {
const reg = new RegExp(`${key}$`);
// 名称后缀不区分大小写
if (reg.test(type) || (!type && reg.test(`${name}`.toLowerCase()))) {
if (reg.test(type) || reg.test(`${name}`.toLowerCase())) {
typeStr = typeMap[key];
}
});
Expand Down
11 changes: 7 additions & 4 deletions src/js/components/form/KLUpload/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ const typeMap = {
'.rar': 'rar',
'.gz': 'gz',
document: 'doc',
sheet: 'doc',
powerpoint: 'doc',
sheet: 'excel',
powerpoint: 'ppt',
msword: 'doc',
'.doc': 'doc',
'.xlsx': 'doc',
'.ppt': 'doc',
'.xlsx': 'excel',
'.xls': 'excel',
'.ppt': 'ppt',
'.pptx': 'ppt',
'video/*': 'video',
'.mp4': 'video',
'.mkv': 'video',
Expand All @@ -40,6 +42,7 @@ const typeMap = {
'.js': 'js',
'.html': 'html',
'.txt': 'text',
'text/plain': 'text',
'.json': 'json',
};

Expand Down

0 comments on commit 2d9782c

Please sign in to comment.