diff --git a/web/client/src/components/UploadLocal/index.js b/web/client/src/components/UploadLocal/index.js index 0af35e2..abd1dfa 100644 --- a/web/client/src/components/UploadLocal/index.js +++ b/web/client/src/components/UploadLocal/index.js @@ -214,7 +214,7 @@ class Uploads extends Component { }); } if (status === 'done') { - let { filename } = info.file.response; + let { filename, realName } = info.file.response; let size = info.file.size; let nextFileList = fileList; nextFileList[nextFileList.length - 1] = { @@ -223,7 +223,8 @@ class Uploads extends Component { status: 'done', storageUrl: filename, url: filename, - size: size + size: size, + realName: realName }; onChange(nextFileList); that.setState({ diff --git a/web/client/src/sections/metadataManagement/containers/filesTable.js b/web/client/src/sections/metadataManagement/containers/filesTable.js index a7ae2d6..96a24e8 100644 --- a/web/client/src/sections/metadataManagement/containers/filesTable.js +++ b/web/client/src/sections/metadataManagement/containers/filesTable.js @@ -279,7 +279,7 @@ const FilesTable = (props) => { if (values.files && values.files.length) { obj.type = values.files[0].name.split('.').pop(); obj.size = values.files[0].size; - obj.fileName = values.files[0].url.split('\\').pop(); + obj.fileName = values.files[0].realName; } dispatch(metadataManagement.postMetadataFiles(obj)).then(res => { if (res.success) { diff --git a/web/routes/attachment/index.js b/web/routes/attachment/index.js index 14df35b..bfcf516 100644 --- a/web/routes/attachment/index.js +++ b/web/routes/attachment/index.js @@ -104,7 +104,7 @@ module.exports = { app.fs.logger.log('error', '[Upload Heatmap]', err); }); ctx.status = 200; - ctx.body = { filename: path.join(`/assets/files/${fileFolder}`, fileName), name: 'UploadSuccess', message: '上传成功' }; + ctx.body = { realName: fileName, filename: path.join(`/assets/files/${fileFolder}`, fileName), name: 'UploadSuccess', message: '上传成功' }; } catch (err) { ctx.status = 500; ctx.fs.logger.error(err);