From 1beca69de6d7f95ee5c07a26c54bf555685e8fda Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 9 Oct 2024 15:59:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=90=8D=E7=A7=B0=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/chart/server/ChartDataServer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/chart/server/ChartDataServer.java b/core/core-backend/src/main/java/io/dataease/chart/server/ChartDataServer.java index 2afa50e916..50c8dec639 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/server/ChartDataServer.java +++ b/core/core-backend/src/main/java/io/dataease/chart/server/ChartDataServer.java @@ -38,6 +38,8 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import java.io.OutputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -111,7 +113,7 @@ public class ChartDataServer implements ChartDataApi { Integer curLimit = getExportLimit(); if (ChartConstants.VIEW_RESULT_MODE.CUSTOM.equals(viewDTO.getResultMode())) { Integer limitCount = viewDTO.getResultCount(); - viewDTO.setResultCount(Math.min(curLimit,limitCount)); + viewDTO.setResultCount(Math.min(curLimit, limitCount)); } else { viewDTO.setResultCount(curLimit); } @@ -184,7 +186,7 @@ public class ChartDataServer implements ChartDataApi { response.setContentType("application/vnd.ms-excel"); //文件名称 - response.setHeader("Content-disposition", "attachment;filename=" + request.getViewName() + ".xlsx"); + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(request.getViewName(), StandardCharsets.UTF_8) + ".xlsx"); wb.write(outputStream); outputStream.flush(); outputStream.close();