mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-15 21:03:42 +00:00
5.0版本 发布 新增 cadviewer转换方法
This commit is contained in:
@@ -97,9 +97,10 @@ public class DownloadUtils {
|
||||
|
||||
factory.setHttpClient(httpClient);
|
||||
restTemplate.setRequestFactory(factory);
|
||||
String finalUrlStr = urlStr;
|
||||
RequestCallback requestCallback = request -> {
|
||||
request.getHeaders().setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM, MediaType.ALL));
|
||||
WebUtils.applyBasicAuthHeaders(request.getHeaders(), fileAttribute);
|
||||
WebUtils.applyBasicAuthHeaders(request.getHeaders(), finalUrlStr);
|
||||
String proxyAuthorization = fileAttribute.getKkProxyAuthorization();
|
||||
if(StringUtils.hasText(proxyAuthorization)){
|
||||
Map<String, String> proxyAuthorizationMap = mapper.readValue(
|
||||
|
||||
@@ -60,6 +60,18 @@ public class KkFileUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean validateFileNameLength(String fileName) {
|
||||
if (fileName == null) {
|
||||
return false;
|
||||
}
|
||||
// 文件名长度限制:255个字符(不包含路径)
|
||||
int windowsMaxLength = 255;
|
||||
if (fileName.length() > windowsMaxLength) {
|
||||
System.err.println("文件名长度超过限制(255个字符)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否是数字
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.keking.utils;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import io.mola.galimatias.GalimatiasParseException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -465,10 +464,8 @@ public class WebUtils {
|
||||
/**
|
||||
* 支持basic 下载方法
|
||||
*/
|
||||
public static void applyBasicAuthHeaders(HttpHeaders headers, FileAttribute fileAttribute) {
|
||||
String url = fileAttribute.getUrl();
|
||||
System.out.println(" T555.");
|
||||
System.out.println(url);
|
||||
public static void applyBasicAuthHeaders(HttpHeaders headers, String url) {
|
||||
|
||||
// 从配置文件读取User-Agent,如果没有配置则使用默认值
|
||||
String customUserAgent=ConfigConstants.getUserAgent();
|
||||
String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
||||
|
||||
Reference in New Issue
Block a user