修复部署后文件下载问题

master
chenxiwang 2024-08-21 13:06:59 +08:00
parent ec07887315
commit 2cbcd3b94d
1 changed files with 3 additions and 1 deletions

View File

@ -195,7 +195,9 @@ public class OsmoticWaterRController {
if (!file.exists()) {
new FileNotFoundException("文件不存在!");
}
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(filePath, "UTF-8"));
response.setCharacterEncoding("utf-8");
response.setContentType("application/octet-stream; charset=UTF-8");
response.setHeader("content-disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode("GB3838-2002地表水环境质量标准.pdf", "UTF-8"));
InputStream inputStream = null;
OutputStream outputStream = null;
try {