From 91d3f4138ce47a801a0d943dd947247d0459db54 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Mon, 7 Apr 2025 17:38:16 -0600 Subject: [PATCH] relative to absolute links in mastoapi content --- src/views/mastoapi.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/mastoapi.nim b/src/views/mastoapi.nim index 1d11e74..2198aad 100644 --- a/src/views/mastoapi.nim +++ b/src/views/mastoapi.nim @@ -4,6 +4,7 @@ import ".."/[types, formatters, utils] proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string = var content = replaceUrls(tweet.text, prefs) + content = content.replace("href=\"/", &"href=\"{getUrlPrefix(cfg)}/") if tweet.poll.isSome(): let poll = get(tweet.poll) @@ -24,7 +25,7 @@ proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string = if tweet.quote.isSome(): let quote = get(tweet.quote) - quoteContent = replaceUrls(quote.text, prefs) + quoteContent = replaceUrls(quote.text, prefs).replace("href=\"/", &"href=\"{getUrlPrefix(cfg)}/") quoteUrl = &"{getUrlPrefix(cfg)}/i/status/{quote.id}" content &= &"\n\n
{quote.user.fullName} (@{quote.user.username})\n{quoteContent}"