1
0
Fork 0

Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img

Increase specificity of [url][img] capture regex in BBCode::getAttachedData
This commit is contained in:
Michael Vogel 2020-02-10 05:32:43 +01:00 committed by GitHub
commit 01640a7045

View file

@ -289,7 +289,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