fix(file): 使用encodeURIComponent替代encodeURI以正确处理文件路径中的特殊字符
- 将多个模板文件中的encodeURI替换为encodeURIComponent - 确保文件下载和预览可以正确处理包含功能空格和特殊字符的文件名 -修复生产环境配置激活问题 - 统一文件操作相关的URL编码方式以增强兼容性dev_1.0.0
parent
52839e343c
commit
d34edb273b
|
|
@ -58,7 +58,7 @@ spring:
|
|||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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(`<iframe src='${url}' style="width: 100%;height
|
||||
:100%">`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1315,12 +1315,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) {
|
||||
if (filePath.endsWith(".png") || filePath.endsWith(".jpg") || filePath.endsWith(".jpeg") || filePath.endsWith(".pdf")) {
|
||||
let url = prefix + `/file/view?filePath=` + encodeURI(filePath) + '&fileName=' + encodeURI(fileName)
|
||||
let url = prefix + `/file/view?filePath=` + encodeURIComponent(filePath) + '&fileName=' + encodeURIComponent(fileName)
|
||||
window.open(url)
|
||||
} else {
|
||||
downFile(filePath, fileName)
|
||||
|
|
|
|||
|
|
@ -1325,13 +1325,13 @@
|
|||
}
|
||||
|
||||
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) {
|
||||
|
||||
if (filePath.endsWith(".png")||filePath.endsWith(".jpg")||filePath.endsWith(".jpeg")||filePath.endsWith(".pdf")){
|
||||
let url = prefix + `/file/view?filePath=` + encodeURI(filePath) + '&fileName=' + encodeURI(fileName)
|
||||
let url = prefix + `/file/view?filePath=` + encodeURIComponent(filePath) + '&fileName=' + encodeURIComponent(fileName)
|
||||
window.open(url)
|
||||
}else{
|
||||
downFile(filePath,fileName)
|
||||
|
|
|
|||
Loading…
Reference in New Issue