1,优化URL报错,2,更新OFD组件 3,美化Excel 4,文本方法关闭字节流 5,新增多种类型文件预览 (#419)
1,优化URL报错 2,更新OFD组件 3,美化Excel 4,文本方法关闭字节流 5,新增xmind、eml、epub、"obj", "3ds", "stl", "ply", "off", "3dm", "fbx", "dae", "wrl", "3mf", "ifc","glb","o3dv","gltf","stp","bim","fcstd","step","iges","brep"格式 Co-authored-by: gaoxiongzaq <admin@cxcp.com>
This commit is contained in:
@ -8,12 +8,13 @@ import javax.servlet.ServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author : kl
|
||||
@ -173,7 +174,23 @@ public class WebUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断地址是否正确
|
||||
* 高 2022/12/17
|
||||
*/
|
||||
public static boolean hefaurl (String url) {
|
||||
String regStr = "^((https|http|ftp|rtsp|mms|file)://)";//[.?*]表示匹配的就是本身
|
||||
Pattern pattern = Pattern.compile(regStr);
|
||||
Matcher matcher = pattern.matcher(url);
|
||||
return matcher.find();
|
||||
}
|
||||
public static boolean kuayu(String host, String wjl) { //查询域名是否相同
|
||||
if (wjl.contains(host)) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 将 Base64 字符串解码,再解码URL参数, 默认使用 UTF-8
|
||||
* @param source 原始 Base64 字符串
|
||||
@ -183,11 +200,10 @@ public class WebUtils {
|
||||
*/
|
||||
public static String decodeUrl(String source) {
|
||||
String url = decodeBase64String(source, StandardCharsets.UTF_8);
|
||||
try {
|
||||
url = URLDecoder.decode(url, StandardCharsets.UTF_8.name());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
if (! StringUtils.isNotBlank(url)){
|
||||
return null;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@ -203,9 +219,13 @@ public class WebUtils {
|
||||
* 有些 Base64 实现可能每 76 个字符插入换行符,也一并去掉
|
||||
* https://github.com/kekingcn/kkFileView/pull/340
|
||||
*/
|
||||
return new String(Base64Utils.decodeFromString(
|
||||
source.replaceAll(" ", "+").replaceAll("\n", "")
|
||||
), charsets);
|
||||
try {
|
||||
return new String(Base64Utils.decodeFromString(source.replaceAll(" ", "+").replaceAll("\n", "")), charsets);
|
||||
} catch (Exception e) {
|
||||
System.out.println("接入方法错误,或者未使用BASE64");
|
||||
// e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user