Skip to content

Commit cf23e0c

Browse files
committed
fix(chatroom): 修复鱼阅 URL 过滤正则表达式
- 在 URL 类型的过滤中添加了对中文字符的处理 - 保留了原有的 URL格式要求,同时支持中文路径
1 parent cdcf5a3 commit cf23e0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/b3log/symphony/processor/ChatroomProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public static String safeParam(String value, String type) {
267267
} else if ("txt".equals(type)) {
268268
return value.replaceAll("[^\\u4e00-\\u9fa5a-zA-Z0-9\\s,。!?;:“”‘’()【】《》…—~-]", "");
269269
} else if ("url".equals(type)) {
270-
String filtered = value.replaceAll("[^a-zA-Z0-9\\-._~:/?#@!$&'()*+,;=%]", "");
270+
String filtered = value.replaceAll("[^\\u4e00-\\u9fa5a-zA-Z0-9\\-._~:/?#@!$&'()*+,;=%]", "");
271271
return filtered.startsWith("https://file.fishpi.cn") ? filtered : "";
272272
} else if ("fontcolor".equals(type)) {
273273
return value.replaceAll("[^0-9a-fA-F]", "")

0 commit comments

Comments
 (0)