]> git.mxchange.org Git - friendica.git/commitdiff
Remove attachment tags before checking for end of body images
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 29 Dec 2022 16:37:36 +0000 (11:37 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 30 Dec 2022 07:10:11 +0000 (02:10 -0500)
src/Model/Item.php

index 112c36a9c836bc67b4ff21657552d12d046f6c8a..8a533ee70074f4a3fcc336941ed3f35e3146ad18 100644 (file)
@@ -3016,6 +3016,8 @@ class Item
                $item['hashtags'] = $tags['hashtags'];
                $item['mentions'] = $tags['mentions'];
 
+               $item['body'] = preg_replace("#\s*\[attachment .*?].*?\[/attachment]\s*#ism", "\n", $item['body']);
+
                if (!$is_preview) {
                        $item['body'] = Post\Media::removeFromEndOfBody($item['body'] ?? '');
                }
@@ -3065,8 +3067,6 @@ class Item
                $attachments = Post\Media::splitAttachments($item['uri-id'], $shared_links, $item['has-media'] ?? false);
                $item['body'] = self::replaceVisualAttachments($attachments, $item['body'] ?? '');
 
-               $item['body'] = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", "\n", $item['body']);
-
                self::putInCache($item);
                $item['body'] = $body;
                $s = $item["rendered-html"];
@@ -3166,7 +3166,7 @@ class Item
                        ],
                ]);
        }
-       
+
 
        /**
         * Check if the body contains a link