From 12df6297d7d164201b7717dd6ef0263f05493a5b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 29 Dec 2022 11:37:36 -0500 Subject: [PATCH] Remove attachment tags before checking for end of body images --- src/Model/Item.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 112c36a9c..8a533ee70 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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