From 69ced1a02f5e8fd786c8b8cb9a8c9a749d5ea2a3 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 23 Nov 2022 22:51:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=93=BE=E6=8E=A5=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/WebSocketDialogMsg.php | 2 +- resources/assets/js/functions/web.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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("")