]> git.mxchange.org Git - friendica.git/commitdiff
Prevent expandTags to be performed on existing links in Module\Api\Mastodon\Statuses
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 12 Sep 2021 04:05:22 +0000 (00:05 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 12 Sep 2021 04:05:22 +0000 (00:05 -0400)
- We never need to expand tags inside of an already existing BBCode url tag

src/Module/Api/Mastodon/Statuses.php

index 6ae076733435aeebc18a339c8cb61a007cec0506..ed5abf1996b9e44cb817b0c43287519627249424 100644 (file)
@@ -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;