mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-07 09:57:37 +00:00
perf: 优化链接识别
This commit is contained in:
parent
81983026b4
commit
954f1be44d
@ -725,7 +725,7 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
$text = str_replace($str, "[:LINK:{$herf}:{$title}:]", $text);
|
||||
}
|
||||
// 文件分享链接
|
||||
preg_match_all("/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#)+)/i", $text, $matchs);
|
||||
preg_match_all("/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+)/i", $text, $matchs);
|
||||
if ($matchs) {
|
||||
foreach ($matchs[0] as $str) {
|
||||
preg_match("/\/single\/file\/(.*?)$/i", $str, $match);
|
||||
|
||||
2
resources/assets/js/functions/web.js
vendored
2
resources/assets/js/functions/web.js
vendored
@ -726,7 +726,7 @@
|
||||
if (/https*:\/\//.test(text)) {
|
||||
text = text.split(/(<[^>]*>)/g).map(string => {
|
||||
if (string && !/<[^>]*>/.test(string)) {
|
||||
string = string.replace(/(^|[^'"])((https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#)+))/g, "$1<a href=\"$2\" target=\"_blank\">$2</a>")
|
||||
string = string.replace(/(^|[^'"])((https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+))/g, "$1<a href=\"$2\" target=\"_blank\">$2</a>")
|
||||
}
|
||||
return string;
|
||||
}).join("")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user