From 0e6459ddb95e5ff8a03369c75c43a03148126363 Mon Sep 17 00:00:00 2001 From: Lily Cohen Date: Mon, 21 Sep 2026 15:46:33 -0600 Subject: [PATCH 1/3] Preserve the original HTML for remote status content --- app/Transformer/Api/StatusStatelessTransformer.php | 5 ++++- app/Transformer/Api/StatusTransformer.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Transformer/Api/StatusStatelessTransformer.php b/app/Transformer/Api/StatusStatelessTransformer.php index 847f511a8..f6a3d92ca 100644 --- a/app/Transformer/Api/StatusStatelessTransformer.php +++ b/app/Transformer/Api/StatusStatelessTransformer.php @@ -22,7 +22,10 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract { $taggedPeople = MediaTagService::get($status->id); $poll = $status->type === 'poll' ? PollService::get($status->id) : null; - $rendered = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : ''; + // Remote posts keep the HTML they arrived with, so the link targets survive + $rendered = $status->local || ! $status->rendered + ? ($status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : '') + : $status->rendered; return [ '_v' => 1, diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php index 97493599b..5ffa99434 100644 --- a/app/Transformer/Api/StatusTransformer.php +++ b/app/Transformer/Api/StatusTransformer.php @@ -24,7 +24,10 @@ class StatusTransformer extends Fractal\TransformerAbstract $pid = request()->user()->profile_id; $taggedPeople = MediaTagService::get($status->id); $poll = $status->type === 'poll' ? PollService::get($status->id, $pid) : null; - $content = $status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : ''; + // Remote posts keep the HTML they arrived with, so the link targets survive + $content = $status->local || ! $status->rendered + ? ($status->caption ? nl2br(Autolink::create()->autolink($status->caption)) : '') + : $status->rendered; return [ '_v' => 1, From 9c0a87e95080279062e3ee6c0718afb21d239af7 Mon Sep 17 00:00:00 2001 From: Lily Cohen Date: Mon, 21 Sep 2026 15:51:28 -0600 Subject: [PATCH 2/3] Select rendered in the comment and profile queries --- app/Http/Controllers/InternalApiController.php | 1 + app/Http/Controllers/PublicApiController.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 96be90edb..2e5f453bf 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -328,6 +328,7 @@ class InternalApiController extends Controller 'id', 'uri', 'caption', + 'rendered', 'profile_id', 'type', 'in_reply_to_id', diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 40e0ac2c4..8f8296894 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -179,7 +179,7 @@ class PublicApiController extends Controller $replies = $status->comments() ->whereNull('reblog_of_id') ->whereIn('scope', $scope) - ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') + ->select('id', 'caption', 'rendered', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') ->where('id', '>=', $request->min_id) ->orderBy('id', 'desc') ->paginate($limit); @@ -188,7 +188,7 @@ class PublicApiController extends Controller $replies = $status->comments() ->whereNull('reblog_of_id') ->whereIn('scope', $scope) - ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') + ->select('id', 'caption', 'rendered', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') ->where('id', '<=', $request->max_id) ->orderBy('id', 'desc') ->paginate($limit); @@ -197,7 +197,7 @@ class PublicApiController extends Controller $replies = Status::whereInReplyToId($status->id) ->whereNull('reblog_of_id') ->whereIn('scope', $scope) - ->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') + ->select('id', 'caption', 'rendered', 'local', 'visibility', 'scope', 'is_nsfw', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at') ->orderBy('id', 'desc') ->paginate($limit); } From cde0613f82a5b2e71859b5ba77f3fc03140593f0 Mon Sep 17 00:00:00 2001 From: Lily Cohen Date: Mon, 21 Sep 2026 16:41:41 -0600 Subject: [PATCH 3/3] Preserve the original HTML in search results --- app/Http/Controllers/SearchController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index e8b12ec3d..d961fde8a 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -340,7 +340,10 @@ class SearchController extends Controller if ($media) { $url = $media->remote_url; } - $content = $item->caption ? Autolink::create()->autolink($item->caption) : null; + // Remote posts keep the HTML they arrived with, so the link targets survive + $content = $item->local || ! $item->rendered + ? ($item->caption ? Autolink::create()->autolink($item->caption) : null) + : $item->rendered; $this->tokens['posts'] = [[ 'count' => 0, 'url' => "/i/web/post/_/$item->profile_id/$item->id", @@ -364,7 +367,10 @@ class SearchController extends Controller if ($media) { $url = $media->remote_url; } - $content = $item->caption ? Autolink::create()->autolink($item->caption) : null; + // Remote posts keep the HTML they arrived with, so the link targets survive + $content = $item->local || ! $item->rendered + ? ($item->caption ? Autolink::create()->autolink($item->caption) : null) + : $item->rendered; $this->tokens['posts'] = [[ 'count' => 0, 'url' => "/i/web/post/_/$item->profile_id/$item->id",