From 54d7a435a3b3acde952c3e71e558e946a9254345 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 21 May 2022 11:46:38 +0000 Subject: [PATCH 1/2] Don't parse tags in links --- src/Content/Text/BBCode.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 4f7ff1f241..77ca4dbe26 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1952,17 +1952,20 @@ class BBCode * - #[url=][/url] * - [url=]#[/url] */ - $text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) use ($simple_html) { - if ($simple_html == self::ACTIVITYPUB) { - return '#' - . XML::escape($matches[1]) . ''; - } else { - return '#'; - } - }, $text); + self::performWithEscapedTags($text, ['url'], function ($text) use ($simple_html) { + $text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) use ($simple_html) { + if ($simple_html == self::ACTIVITYPUB) { + return '#' + . XML::escape($matches[1]) . ''; + } else { + return '#'; + } + }, $text); + return $text; + }); // We need no target="_blank" rel="noopener noreferrer" for local links // convert links start with DI::baseUrl() as local link without the target="_blank" rel="noopener noreferrer" attribute From 087ad25c87a4276f6082c0d710dae603aab4909c Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 21 May 2022 11:55:38 +0000 Subject: [PATCH 2/2] Escape the "share" as well --- src/Content/Text/BBCode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 77ca4dbe26..8a3eb3d570 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1952,7 +1952,7 @@ class BBCode * - #[url=][/url] * - [url=]#[/url] */ - self::performWithEscapedTags($text, ['url'], function ($text) use ($simple_html) { + self::performWithEscapedTags($text, ['url', 'share'], function ($text) use ($simple_html) { $text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) use ($simple_html) { if ($simple_html == self::ACTIVITYPUB) { return '