]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Transmitter.php
Merge pull request #12919 from annando/html-media-update
[friendica.git] / src / Protocol / ActivityPub / Transmitter.php
index 02dc7ff544ef8c636f52dde0ab84cca0efdcff74..7da110f6716dfd5fb6a2e284e727e19d85e551b8 100644 (file)
@@ -1639,6 +1639,8 @@ class Transmitter
 
                $real_quote = false;
 
+               $item = Post\Media::addHTMLAttachmentToItem($item);
+
                $body = $item['body'];
 
                if ($type == 'Note') {
@@ -1675,7 +1677,7 @@ class Transmitter
                        if ($type == 'Page') {
                                // When we transmit "Page" posts we have to remove the attachment.
                                // The attachment contains the link that we already transmit in the "url" field.
-                               $body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body);
+                               $body = BBCode::removeAttachment($body);
                        }
 
                        $body = BBCode::setMentionsToNicknames($body);
@@ -1707,7 +1709,7 @@ class Transmitter
                                        $richbody = DI::contentItem()->addSharedPost($item, $richbody);
                                }
                        }
-                       $richbody = BBCode::removeAttachment($richbody);
+                       $richbody = BBCode::replaceAttachment($richbody);
 
                        $data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL);
                }