Skip to content

Commit

Permalink
⬆️ upgrade Hutool
Browse files Browse the repository at this point in the history
  • Loading branch information
shuleisanshi committed Oct 29, 2019
1 parent c7f2360 commit b5862e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 16 additions & 2 deletions util/pom.xml
Expand Up @@ -14,6 +14,7 @@

<properties>
<java.version>1.8</java.version>
<hutool-core.version>5.0.3</hutool-core.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -51,10 +52,23 @@
<version>3.14.2</version>
</dependency>

<!-- Hutool 工具集 https://www.hutool.cn/docs/index.html#/ -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.6.1</version>
<artifactId>hutool-core</artifactId>
<version>${hutool-core.version}</version>
</dependency>

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<version>${hutool-core.version}</version>
</dependency>

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>${hutool-core.version}</version>
</dependency>

<dependency>
Expand Down
@@ -1,12 +1,12 @@
package com.youngbingdong.util.excel;

import cn.hutool.core.codec.Base64;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.youngbingdong.util.spring.RequestHolder;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
Expand Down Expand Up @@ -69,9 +69,8 @@ public static void writeToWeb(String fileName, List<?> data) throws IOException
private static String fileNameEncoding(String fileName) throws IOException {
String agent = RequestHolder.currentRequest().getHeader("User-Agent");
if (agent.contains("Firefox")) {
BASE64Encoder base64Encoder = new BASE64Encoder();
fileName = "=?utf-8?B?"
+ base64Encoder.encode(fileName.getBytes(StandardCharsets.UTF_8)) + "?=";
+ Base64.encode(fileName.getBytes(StandardCharsets.UTF_8)) + "?=";
} else {
fileName = URLEncoder.encode(fileName, "utf-8");
}
Expand Down

0 comments on commit b5862e6

Please sign in to comment.