aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-11-03 15:13:31 +0100
committerdefault <nobody@localhost>2024-11-03 15:13:31 +0100
commita5942432bf92b1658ea206f8beb1b120c327bc93 (patch)
tree6c279294cfb3dc8f4f11dad55cc28be3b989077a
parent6501187c74e83f52ea5eecbad2cee024afe5a1bb (diff)
Fixed processing of URLs with two @ inside.
-rw-r--r--format.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/format.c b/format.c
index 9d7ed18..d0b535d 100644
--- a/format.c
+++ b/format.c
@@ -135,7 +135,9 @@ static xs_str *format_line(const char *line, xs_list **attach)
else
if (*v == '[') {
/* markdown-like links [label](url) */
- xs *w = xs_strip_chars_i(xs_replace(v, "#", "&#35;"), "[)");
+ xs *w = xs_strip_chars_i(
+ xs_replace_i(xs_replace(v, "#", "&#35;"), "@", "&#64;"),
+ "![)");
xs *l = xs_split_n(w, "](", 1);
if (xs_list_len(l) == 2) {
@@ -150,7 +152,9 @@ static xs_str *format_line(const char *line, xs_list **attach)
else
if (*v == '!') {
/* markdown-like images ![alt text](url to image) */
- xs *w = xs_strip_chars_i(xs_replace(v, "#", "&#35;"), "![)");
+ xs *w = xs_strip_chars_i(
+ xs_replace_i(xs_replace(v, "#", "&#35;"), "@", "&#64;"),
+ "![)");
xs *l = xs_split_n(w, "](", 1);
if (xs_list_len(l) == 2) {
@@ -179,7 +183,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
}
else
if (xs_str_in(v, ":/" "/") != -1) {
- xs *u = xs_replace(v, "#", "&#35;");
+ xs *u = xs_replace_i(xs_replace(v, "#", "&#35;"), "@", "&#64;");
+
xs *v2 = xs_strip_chars_i(xs_dup(u), ".,)");
const char *mime = xs_mime_by_ext(v2);