From d34edb273b4a664725cf26553e060fbbfb058454 Mon Sep 17 00:00:00 2001 From: chenhao Date: Thu, 20 Nov 2025 10:27:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(file):=20=E4=BD=BF=E7=94=A8encodeURICompone?= =?UTF-8?q?nt=E6=9B=BF=E4=BB=A3encodeURI=E4=BB=A5=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将多个模板文件中的encodeURI替换为encodeURIComponent - 确保文件下载和预览可以正确处理包含功能空格和特殊字符的文件名 -修复生产环境配置激活问题 - 统一文件操作相关的URL编码方式以增强兼容性 --- ruoyi-admin/src/main/resources/application.yml | 2 +- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 4 ++-- .../main/resources/templates/demo/table/exportSelected.html | 2 +- .../src/main/resources/templates/manage/delivery/import.html | 2 +- .../src/main/resources/templates/project/order/add.html | 4 ++-- .../src/main/resources/templates/project/order/approve.html | 4 ++-- .../src/main/resources/templates/project/order/edit.html | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index efc2d1ca..ca0c4754 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -58,7 +58,7 @@ spring: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss profiles: - active: dev + active: prod # 文件上传 servlet: multipart: diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index b1256853..b9632e47 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -386,7 +386,7 @@ var table = { $.modal.loading("正在导出数据,请稍候..."); $.post(table.options.exportUrl, dataParam, function (result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.msg) + "&delete=" + true; } else if (result.code == web_status.WARNING) { $.modal.alertWarning(result.msg) } else { @@ -400,7 +400,7 @@ var table = { importTemplate: function () { $.get(activeWindow().table.options.importTemplateUrl, function (result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.msg) + "&delete=" + true; } else if (result.code == web_status.WARNING) { $.modal.alertWarning(result.msg) } else { diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html b/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html index 657bb835..ebf76cf4 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html @@ -108,7 +108,7 @@ $.modal.confirm(tipMsg, function() { $.post(prefix + "/exportData", dataParam, function(result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" + encodeURIComponent(result.msg) + "&delete=" + true; } else { $.modal.alertError(result.msg); } diff --git a/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html b/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html index 41ad8528..372e6229 100644 --- a/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html +++ b/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html @@ -104,7 +104,7 @@ url: prefix + "/list", $.modal.loading("正在下载,请稍候..."); $.post( prefix + "/export", {deliveryId:-1,productCode:'',serialNumber:''}, function(result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" +encodeURI(result.msg) + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" +encodeURIComponent(result.msg) + "&delete=" + true; } else if (result.code == web_status.WARNING) { $.modal.alertWarning(result.msg) } else { diff --git a/ruoyi-admin/src/main/resources/templates/project/order/add.html b/ruoyi-admin/src/main/resources/templates/project/order/add.html index 3771b52f..b6ae85e0 100644 --- a/ruoyi-admin/src/main/resources/templates/project/order/add.html +++ b/ruoyi-admin/src/main/resources/templates/project/order/add.html @@ -982,12 +982,12 @@ ${ } function downFile(filePath, fileName) { - window.location.href = prefix + `/file/download?filePath=` + encodeURI(filePath) + '&fileName=' + encodeURI(fileName); + window.location.href = prefix + `/file/download?filePath=` + encodeURIComponent(filePath) + '&fileName=' + encodeURIComponent(fileName); } function preview(filePath, fileName) { let iframe = window.open('', 'iframe') - let url = ctx + prefix + `/file/download?filePath=` + encodeURI(filePath) + '&fileName=' + encodeURI(fileName) + let url = ctx + prefix + `/file/download?filePath=` + encodeURIComponent(filePath) + '&fileName=' + encodeURIComponent(fileName) iframe.document.write(`