新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
This commit is contained in:
高雄 2023-04-03 07:06:46 +00:00 committed by Gitee
parent 83d04ca45d
commit 1e771ed649
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,8 @@ import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -273,6 +275,14 @@ public class FileHandlerService {
FileType type;
String fileName;
String fullFileName = WebUtils.getUrlParameterReg(url, "fullfilename");
String urlStrr = null;
URL urll;
try {
urll = new URL(url);
urlStrr = URLDecoder.decode(urll.getPath(), "UTF-8");
} catch (Exception e) {
}
if (StringUtils.hasText(fullFileName)) {
fileName = fullFileName;
type = FileType.typeFromFileName(fullFileName);
@ -283,8 +293,10 @@ public class FileHandlerService {
suffix = WebUtils.suffixFromUrl(url);
}
if (url.contains("?fileKey=")) {
fileName=urlStrr;
attribute.setSkipDownLoad(true);
}
// System.out.println(fileName);
url = WebUtils.encodeUrlFileName(url);
fileName = KkFileUtils.htmlEscape(fileName); //文件名处理
attribute.setType(type);