]> git.mxchange.org Git - friendica.git/commitdiff
Improved link removal
authorMichael <heluecht@pirati.ca>
Mon, 25 Sep 2023 22:05:53 +0000 (22:05 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 25 Sep 2023 22:05:53 +0000 (22:05 +0000)
src/Content/Text/BBCode.php
src/Model/Post/Engagement.php

index a981f97d2804c4678152b640f43d01af595c6de9..5779ab3a2c6559af99288ad8f27cabe8869cdf7d 100644 (file)
@@ -1113,6 +1113,7 @@ class BBCode
        public static function removeLinks(string $bbcode): string
        {
                DI::profiler()->startRecording('rendering');
+               $bbcode = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", ' ', $bbcode);
                $bbcode = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", ' $1 ', $bbcode);
                $bbcode = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $bbcode);
 
index 4c6f6e0e559b493cfb96067f664696382261036f..ca6ef8d9fc02adebcb7f35b5ac4e21b40f7e5701 100644 (file)
@@ -35,6 +35,7 @@ use Friendica\Model\Verb;
 use Friendica\Protocol\Activity;
 use Friendica\Protocol\Relay;
 use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Strings;
 
 // Channel
 
@@ -161,6 +162,7 @@ class Engagement
 
                $body = Post\Media::addAttachmentsToBody($item['uri-id'], $body, [Post\Media::IMAGE]);
                $text = BBCode::toPlaintext($body, false);
+               $text = preg_replace(Strings::autoLinkRegEx(), '', $text);
 
                do {
                        $oldtext = $text;