diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 8c526eaf1..b04b2a3a2 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -671,7 +671,7 @@ class WebSocketDialogMsg extends AbstractModel $text = str_replace($matchs[0][$key], "[:{$matchChar[1]}:{$keyId}:{$matchValye[1]}:]", $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); diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index f8f5e3ef0..219c8a265 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -422,7 +422,7 @@ if (/https*:\/\//.test(text)) { text = text.split(/(<[^>]*>)/g).map(string => { if (string && !/<[^>]*>/.test(string)) { - string = string.replace(/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#)+)/g, "$1$2") + string = string.replace(/(?<=[^'"])(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#)+)/g, "$1$2") } return string; }).join("")