Эх сурвалжийг харах

文件下载时对文件名进行编码

xujunjie 1 жил өмнө
parent
commit
a9e17fc6a9

+ 5 - 1
src/components/AttachmentTable/index.js

@@ -43,7 +43,11 @@ function AttachmentTable(props) {
     },
     },
   ];
   ];
   const downloadFile = record => {
   const downloadFile = record => {
-    window.location.href = `${record.url}`;
+    let urls = record.url.split('/');
+    let lastIndex = urls.length - 1;
+    // 对文件名编码
+    urls[lastIndex] = encodeURIComponent(urls[lastIndex]);
+    window.location.href = urls.join('/');
   };
   };
   const deleteFile = id => {
   const deleteFile = id => {
     Modal.confirm({
     Modal.confirm({