5.0版本 发布 新增pptm 新增heif 美化heif 模板 美化tif 美化md 优化http方法 优化首页目录读取方法

This commit is contained in:
高雄
2026-01-23 15:50:24 +08:00
parent b08f4657e5
commit 0aa8de27d4
19 changed files with 13656 additions and 77728 deletions

View File

@@ -36,8 +36,8 @@ public enum FileType {
MSG("msgFilePreviewImpl"),
DRAWIO("drawioFilePreviewImpl");
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "docm", "xls", "xlsx", "csv" ,"xlsm", "ppt", "pptx", "vsd", "rtf", "odt", "wmf", "emf", "dps", "et", "ods", "ots", "tsv", "odp", "otp", "sxi", "ott", "vsdx", "fodt", "fods", "xltx","tga","psd","dotm","ett","xlt","xltm","wpt","dot","xlam","dotx","xla","pages", "eps"};
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "jfif", "webp", "heic", "avif"};
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "docm", "xls", "xlsx", "csv" ,"xlsm", "ppt", "pptx", "vsd", "rtf", "odt", "wmf", "emf", "dps", "et", "ods", "ots", "tsv", "odp", "otp", "sxi", "ott", "vsdx", "fodt", "fods", "xltx","tga","psd","dotm","ett","xlt","xltm","wpt","dot","xlam","dotx","xla","pages", "eps", "pptm"};
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "jfif", "webp", "heic", "avif", "heif"};
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
private static final String[] ONLINE3D_TYPES = {"obj", "3ds", "stl", "ply", "off", "3dm", "fbx", "dae", "wrl", "3mf", "ifc","glb","o3dv","gltf","stp","bim","fcstd","step","iges","brep"};
private static final String[] EML_TYPES = {"eml"};

View File

@@ -45,7 +45,7 @@ public class PictureFilePreviewImpl extends CommonPreviewImpl {
}
}
if(suffix.equalsIgnoreCase("heic")){
if(suffix.equalsIgnoreCase("heic")||suffix.equalsIgnoreCase("heif")){
return HEIC_FILE_PREVIEW_PAGE;
}else {
return PICTURE_FILE_PREVIEW_PAGE;

View File

@@ -27,6 +27,7 @@ import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Map;
@@ -54,6 +55,43 @@ public class HttpRequestUtils {
private static final int DEFAULT_MAX_TOTAL = 200; // 最大连接数
private static final int DEFAULT_MAX_PER_ROUTE = 50; // 每个路由最大连接数
/**
* 判断是否为客户端中断连接的异常
*/
public static boolean isClientAbortException(Throwable e) {
if (e == null) {
return false;
}
// 检查异常链
Throwable cause = e;
while (cause != null) {
// 检查异常消息
if (cause instanceof IOException) {
String message = cause.getMessage();
if (message != null && (
message.contains("你的主机中的软件中止了一个已建立的连接") ||
message.contains("Broken pipe") ||
message.contains("Connection reset by peer") ||
message.contains("ClientAbortException"))) {
return true;
}
}
// 检查异常类型
String className = cause.getClass().getName();
if (className.contains("ClientAbortException") ||
className.contains("AbortedException") ||
className.contains("AsyncRequestNotUsableException")) {
return true;
}
cause = cause.getCause();
}
return false;
}
/**
* 初始化连接池管理器(懒加载)
*/
@@ -238,12 +276,31 @@ public class HttpRequestUtils {
try {
handler.handleResponse(wrapper);
} catch (Exception e) {
logger.error("处理文件响应时出错", e);
throw new RuntimeException(e);
// 如果是客户端中断连接,不再记录为错误
if (isClientAbortException(e)) {
if (logger.isDebugEnabled()) {
logger.debug("客户端中断连接可能用户取消了下载URL: {}", url);
}
} else {
logger.error("处理文件响应时出错", e);
}
try {
throw e;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
return null;
});
} catch (Exception e) {
// 如果是客户端中断连接,不再记录为错误
if (isClientAbortException(e)) {
if (logger.isDebugEnabled()) {
logger.debug("客户端中断连接URL: {}", url);
}
throw e; // 重新抛出,让调用者处理
}
// 如果是SSL证书错误给出建议
if (e.getMessage() != null &&
(e.getMessage().contains("SSL") ||

View File

@@ -174,7 +174,7 @@ public class OnlinePreviewController {
}
FileAttribute fileAttribute = fileHandlerService.getFileAttribute(urlPath, req);
InputStream inputStream = null;
logger.info("读取跨域pdf文件url{}", urlPath);
logger.info("读取跨域文件url{}", urlPath);
if (!isFtpUrl(url)) {
CloseableHttpClient httpClient = HttpRequestUtils.createConfiguredHttpClient();