fix(file): 使用encodeURIComponent替代encodeURI以正确处理文件路径中的特殊字符
- 将多个模板文件中的encodeURI替换为encodeURIComponent - 确保文件下载和预览可以正确处理包含功能空格和特殊字符的文件名 -修复生产环境配置激活问题 - 统一文件操作相关的URL编码方式以增强兼容性dev_1.0.0
parent
52839e343c
commit
d34edb273b
|
|
@ -58,7 +58,7 @@ spring:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ var table = {
|
||||||
$.modal.loading("正在导出数据,请稍候...");
|
$.modal.loading("正在导出数据,请稍候...");
|
||||||
$.post(table.options.exportUrl, dataParam, function (result) {
|
$.post(table.options.exportUrl, dataParam, function (result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
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) {
|
} else if (result.code == web_status.WARNING) {
|
||||||
$.modal.alertWarning(result.msg)
|
$.modal.alertWarning(result.msg)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -400,7 +400,7 @@ var table = {
|
||||||
importTemplate: function () {
|
importTemplate: function () {
|
||||||
$.get(activeWindow().table.options.importTemplateUrl, function (result) {
|
$.get(activeWindow().table.options.importTemplateUrl, function (result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
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) {
|
} else if (result.code == web_status.WARNING) {
|
||||||
$.modal.alertWarning(result.msg)
|
$.modal.alertWarning(result.msg)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
$.modal.confirm(tipMsg, function() {
|
$.modal.confirm(tipMsg, function() {
|
||||||
$.post(prefix + "/exportData", dataParam, function(result) {
|
$.post(prefix + "/exportData", dataParam, function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
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 {
|
} else {
|
||||||
$.modal.alertError(result.msg);
|
$.modal.alertError(result.msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ url: prefix + "/list",
|
||||||
$.modal.loading("正在下载,请稍候...");
|
$.modal.loading("正在下载,请稍候...");
|
||||||
$.post( prefix + "/export", {deliveryId:-1,productCode:'',serialNumber:''}, function(result) {
|
$.post( prefix + "/export", {deliveryId:-1,productCode:'',serialNumber:''}, function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
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) {
|
} else if (result.code == web_status.WARNING) {
|
||||||
$.modal.alertWarning(result.msg)
|
$.modal.alertWarning(result.msg)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -982,12 +982,12 @@ ${
|
||||||
}
|
}
|
||||||
|
|
||||||
function downFile(filePath, fileName) {
|
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) {
|
function preview(filePath, fileName) {
|
||||||
let iframe = window.open('', 'iframe')
|
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
|
iframe.document.write(`<iframe src='${url}' style="width: 100%;height
|
||||||
:100%">`)
|
:100%">`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1315,12 +1315,12 @@ ${
|
||||||
}
|
}
|
||||||
|
|
||||||
function downFile(filePath, fileName) {
|
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) {
|
function preview(filePath, fileName) {
|
||||||
if (filePath.endsWith(".png") || filePath.endsWith(".jpg") || filePath.endsWith(".jpeg") || filePath.endsWith(".pdf")) {
|
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)
|
window.open(url)
|
||||||
} else {
|
} else {
|
||||||
downFile(filePath, fileName)
|
downFile(filePath, fileName)
|
||||||
|
|
|
||||||
|
|
@ -1325,13 +1325,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function downFile(filePath, fileName) {
|
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) {
|
function preview(filePath, fileName) {
|
||||||
|
|
||||||
if (filePath.endsWith(".png")||filePath.endsWith(".jpg")||filePath.endsWith(".jpeg")||filePath.endsWith(".pdf")){
|
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)
|
window.open(url)
|
||||||
}else{
|
}else{
|
||||||
downFile(filePath,fileName)
|
downFile(filePath,fileName)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue