summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md2
-rw-r--r--TODO.md2
-rw-r--r--format.c5
3 files changed, 7 insertions, 2 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 9598403..6f76a9f 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -2,6 +2,8 @@
## 2.35
+Fixed URL links with the # symbol on them.
+
There is new a user configuration setup checkbox to mark an account as a bot.
Mastodon API: several bug fixes (contributed by Poesty).
diff --git a/TODO.md b/TODO.md
index 7b105ae..c1a21b0 100644
--- a/TODO.md
+++ b/TODO.md
@@ -249,3 +249,5 @@ Mastodon API: implement 'unreblog' (unboost) (2023-05-19T21:25:24+0200).
Do something with @mentions without host; complete with followed people, or with local users. Or just do nothing. I'm not sure (2023-05-21T20:19:15+0200).
Add (back) the possibility to attach an image by URL (2023-05-21T20:35:39+0200).
+
+Fix broken links that contain # (https://codeberg.org/grunfink/snac2/issues/47#issuecomment-937014) (2023-06-12T19:03:45+0200).
diff --git a/format.c b/format.c
index aad27d9..82af20b 100644
--- a/format.c
+++ b/format.c
@@ -73,7 +73,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
}
else
if (xs_startswith(v, "http")) {
- xs *v2 = xs_strip_chars_i(xs_dup(v), ".");
+ xs *u = xs_replace(v, "#", "#");
+ xs *v2 = xs_strip_chars_i(xs_dup(u), ".");
const char *mime = xs_mime_by_ext(v2);
@@ -89,7 +90,7 @@ static xs_str *format_line(const char *line, xs_list **attach)
*attach = xs_list_append(*attach, d);
}
else {
- xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, v);
+ xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u);
s = xs_str_cat(s, s1);
}
}