mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-10-26 02:39:11 +08:00
文件url采用base64加encodeURI双重编码,彻底解决各种奇葩文件名导致的下载异常
This commit is contained in:
@@ -19,12 +19,10 @@ import org.springframework.util.StringUtils;
|
||||
public class CompressFilePreviewImpl implements FilePreview {
|
||||
|
||||
private final FileHandlerService fileHandlerService;
|
||||
private final DownloadUtils downloadUtils;
|
||||
private final CompressFileReader compressFileReader;
|
||||
|
||||
public CompressFilePreviewImpl(FileHandlerService fileHandlerService, DownloadUtils downloadUtils, CompressFileReader compressFileReader) {
|
||||
public CompressFilePreviewImpl(FileHandlerService fileHandlerService, CompressFileReader compressFileReader) {
|
||||
this.fileHandlerService = fileHandlerService;
|
||||
this.downloadUtils = downloadUtils;
|
||||
this.compressFileReader = compressFileReader;
|
||||
}
|
||||
|
||||
@@ -35,7 +33,7 @@ public class CompressFilePreviewImpl implements FilePreview {
|
||||
String fileTree = null;
|
||||
// 判断文件名是否存在(redis缓存读取)
|
||||
if (!StringUtils.hasText(fileHandlerService.getConvertedFile(fileName)) || !ConfigConstants.isCacheEnabled()) {
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(fileAttribute, fileName);
|
||||
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("fileType", suffix);
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
|
||||
Reference in New Issue
Block a user