From d2ca5ccd354e3f252e434291d3465505080304ee Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 9 Feb 2020 22:19:21 -0500 Subject: [PATCH] Increase specificity of [url][img] capture regex in BBCode::getAttachedData - Prevents it from over capturing when there's a [url] tag before the image --- 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 f8b9fb2985..3c6b7062de 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -273,7 +273,7 @@ class BBCode $body = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", '[img]$1[/img]', $body); $post['text'] = $body; - if (preg_match_all("(\[url=(.*?)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\])ism", $body, $pictures, PREG_SET_ORDER)) { + if (preg_match_all("#\[url=([^\]]+?)\]\s*\[img\]([^\[]+?)\[/img\]\s*\[/url\]#ism", $body, $pictures, PREG_SET_ORDER)) { if ((count($pictures) == 1) && !$has_title) { if (!empty($item['object-type']) && ($item['object-type'] == Activity\ObjectType::IMAGE)) { // Replace the preview picture with the real picture -- 2.39.5