From 5a93bb6effae8921e767501a66f76ffbc2fd05bc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 12 Sep 2021 00:05:22 -0400 Subject: [PATCH] Prevent expandTags to be performed on existing links in Module\Api\Mastodon\Statuses - We never need to expand tags inside of an already existing BBCode url tag --- src/Module/Api/Mastodon/Statuses.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 6ae076733..ed5abf199 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -63,7 +63,10 @@ class Statuses extends BaseApi // The imput is defined as text. So we can use Markdown for some enhancements $body = Markdown::toBBCode($request['status']); - $body = BBCode::expandTags($body); + // Avoids potential double expansion of existing links + $body = BBCode::performWithEscapedTags($body, ['url'], function ($body) { + return BBCode::expandTags($body); + }); $item = []; $item['uid'] = $uid;