From: Michael <heluecht@pirati.ca>
Date: Tue, 6 Jul 2021 08:40:59 +0000 (+0000)
Subject: Modfy links for attachments
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b7a4ef0ec1c14afeee33abff7bf18682960e32f8;p=friendica.git

Modfy links for attachments
---

diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index f9cdfd1f9b..ec56b2c35c 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1411,7 +1411,16 @@ class BBCode
 				} elseif (!in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::CONNECTORS])) {
 					$text = self::removeAttachment($text, true);
 				} else {
-					$text = self::convertAttachment($text, $simple_html, $try_oembed);
+					$data = self::getAttachmentData($text);
+					if (!empty($data['image'])) {
+						$data['image']   = Post\Link::getByLink($uriid, $data['image']);
+					}
+	
+					if (!empty($data['preview'])) {
+						$data['preview'] = Post\Link::getByLink($uriid, $data['preview']);
+					}
+
+					$text = self::convertAttachment($text, $simple_html, $try_oembed, $data);
 				}
 
 				$nosmile = strpos($text, '[nosmile]') !== false;