From: Hypolite Petovan Date: Sun, 12 Sep 2021 04:05:22 +0000 (-0400) Subject: Prevent expandTags to be performed on existing links in Module\Api\Mastodon\Statuses X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5a93bb6effae8921e767501a66f76ffbc2fd05bc;p=friendica.git 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 --- diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 6ae0767334..ed5abf1996 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;