mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-08-20 00:44:35 +08:00
update server/src/main/java/cn/keking/service/impl/CommonPreviewImpl.java.
压缩文件无法预览问题修复 Signed-off-by: 马云 <12845730+jack-ma2023@user.noreply.gitee.com>
This commit is contained in:
parent
6746325bf2
commit
af53518be2
@ -33,13 +33,18 @@ public class CommonPreviewImpl implements FilePreview {
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
// 不是http开头,浏览器不能直接访问,需下载到本地
|
||||
if (url != null && !url.toLowerCase().startsWith("http")) {
|
||||
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, null);
|
||||
if (response.isFailure()) {
|
||||
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
|
||||
String originFilePath = "";
|
||||
if(fileAttribute.getCompressFile()) {
|
||||
originFilePath = fileAttribute.getOriginFilePath();
|
||||
} else {
|
||||
String file = fileHandlerService.getRelativePath(response.getContent());
|
||||
model.addAttribute("currentUrl", file);
|
||||
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, null);
|
||||
if (response.isFailure()) {
|
||||
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
|
||||
}
|
||||
originFilePath = response.getContent();
|
||||
}
|
||||
String file = fileHandlerService.getRelativePath(originFilePath);
|
||||
model.addAttribute("currentUrl", file);
|
||||
} else {
|
||||
model.addAttribute("currentUrl", url);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user