diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index 5f9a50dc6..02afb1c67 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -713,6 +713,7 @@ class DialogController extends AbstractController // if (in_array($text_type, ['md', 'markdown'])) { $text = Str::markdown($text); + $text = preg_replace("/\>\r?\n\s*+\", "><", $text); } $text = WebSocketDialogMsg::formatMsg($text, $dialog_id); $strlen = mb_strlen($text); diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 2929d07e2..7750f9917 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -741,14 +741,14 @@ class WebSocketDialogMsg extends AbstractModel // 过滤标签 $text = strip_tags($text, '
'); $text = preg_replace("/\<(blockquote|strong|pre|ol|ul|li|em|p|s|u).*?\>/is", "<$1>", $text); // 不用去除a标签,上面已经处理过了 + $text = preg_replace_callback("/\[:LINK:(.*?):(.*?):\]/i", function (array $match) { + return "" . base64_decode($match[2]) . ""; + }, $text); $text = preg_replace("/\[:IMAGE:(.*?):(.*?):(.*?):(.*?):(.*?):\]/i", "", $text); $text = preg_replace("/\[:@:(.*?):(.*?):\]/i", "@$2", $text); $text = preg_replace("/\[:#:(.*?):(.*?):\]/i", "#$2", $text); $text = preg_replace("/\[:~:(.*?):(.*?):\]/i", "~$2", $text); $text = preg_replace("/\[:QUICK:(.*?):(.*?):\]/i", "$2", $text); - $text = preg_replace_callback("/\[:LINK:(.*?):(.*?):\]/i", function (array $match) { - return "" . base64_decode($match[2]) . ""; - }, $text); return preg_replace("/^(
<\/p>)+|(
<\/p>)+$/i", "", $text); }