fix:修复Bug【69857】
报告里只有xls文件,下载后压缩包名称应该不变化,只是打开是空的。
This commit is contained in:
@@ -433,9 +433,11 @@ public class ReportManageConroller {
|
||||
}
|
||||
}
|
||||
|
||||
response.setContentType("application/x-download");
|
||||
//待下载的文件id List
|
||||
List<String> downLoadFileIds;
|
||||
String reportName = reportDao.selectById(reportId).getName() + ".zip";
|
||||
// 获取编码后的文件名
|
||||
String encodedZipName = URLEncoder.encode(reportName, "UTF-8");
|
||||
|
||||
//判断是从列表页面下载 还是预览页面下载
|
||||
if (CollectionUtils.isEmpty(fileIdList)) {
|
||||
@@ -447,7 +449,11 @@ public class ReportManageConroller {
|
||||
try {
|
||||
// 设置响应头信息
|
||||
response.setContentType("application/zip");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + zipFileName);
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||
response.setHeader("Pragma", "public");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
response.setHeader("Expires", "0");
|
||||
|
||||
// 创建空的ZipOutputStream
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
|
||||
@@ -507,12 +513,9 @@ public class ReportManageConroller {
|
||||
}
|
||||
} else {
|
||||
List<String> filePaths = new ArrayList<>();
|
||||
String reportName = reportDao.selectById(reportId).getName() + ".zip";
|
||||
// 获取编码后的文件名
|
||||
String encodedFileName = URLEncoder.encode(reportName, "UTF-8");
|
||||
// 设置响应头信息
|
||||
response.setContentType("application/zip");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName);
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + encodedZipName);
|
||||
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||
response.setHeader("Pragma", "public");
|
||||
response.setHeader("Cache-Control", "no-store");
|
||||
|
||||
Reference in New Issue
Block a user