From 4b1d48038089ef082f1044e1be0911445f2a0847 Mon Sep 17 00:00:00 2001 From: tianwenbo Date: Tue, 7 Mar 2023 17:12:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91=20CommonControlle?= =?UTF-8?q?r.java=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jero/modules/system/controller/CommonController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java index c4d102d1..f4473209 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java @@ -64,7 +64,7 @@ public class CommonController { @Value(value="${jero.fileSuffixLimits}") private String[] fileSuffixLimits; - private static String UTF8 ="UTF-8"; + private static final String UTF8 ="UTF-8"; /** * @Author 政辉 @@ -176,7 +176,7 @@ public class CommonController { fileName = ossFile.getFileName(); inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), url); } - response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes(UTF8),StandardCharsets.ISO_8859_1)); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1)); response.setContentType("application/force-download");// 设置强制下载不打开 outputStream = response.getOutputStream(); byte[] buf = new byte[1024]; @@ -311,7 +311,7 @@ public class CommonController { throw new RuntimeException("文件["+imgPath+"]不存在.."); } response.setContentType("application/force-download");// 设置强制下载不打开 - response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes(UTF8), StandardCharsets.ISO_8859_1)); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); inputStream = new BufferedInputStream(new FileInputStream(filePath)); outputStream = response.getOutputStream(); byte[] buf = new byte[1024];