From 4cafe11d4dd47e3ffa6169d5f69b1e4fbf1f1ef3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 13 Mar 2019 23:07:27 -0400 Subject: [PATCH] Swap attachment conversion and autolinking in BBCode::convert - Fixes a rare display bug where an attachment description ends with a text URL --- src/Content/Text/BBCode.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 2d1c681f4f..5474be98d8 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1266,6 +1266,9 @@ class BBCode extends BaseObject // Set up the parameters for a MAIL search string $MAILSearchString = $URLSearchString; + // Handle attached links or videos + $text = self::convertAttachment($text, $simple_html, $try_oembed); + // if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text if (!$for_plaintext) { $text = preg_replace(Strings::autoLinkRegEx(), '[url]$1[/url]', $text); @@ -1278,10 +1281,6 @@ class BBCode extends BaseObject $text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::removePictureLinksCallback', $text); } - - // Handle attached links or videos - $text = self::convertAttachment($text, $simple_html, $try_oembed); - $text = str_replace(["\r","\n"], ['
', '
'], $text); // Remove all hashtag addresses -- 2.39.5