From e251c61382d4cd39ed89876a37962acab1122f84 Mon Sep 17 00:00:00 2001 From: green Date: Tue, 1 Apr 2025 23:08:48 +0200 Subject: allow emoji urls with no extension --- format.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'format.c') diff --git a/format.c b/format.c index b2b585d..43dd638 100644 --- a/format.c +++ b/format.c @@ -385,7 +385,8 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag const char *t = NULL; /* is it an URL to an image? */ - if (xs_startswith(v, "https:/" "/") && xs_startswith((t = xs_mime_by_ext(v)), "image/")) { + if (xs_startswith(v, "https:/" "/") && + (xs_startswith((t = xs_mime_by_ext(v)), "image/") || strrchr(v, '.') == NULL)) { if (tag && xs_str_in(s, k) != -1) { /* add the emoji to the tag list */ xs *e = xs_dict_new(); -- cgit v1.2.3 From 15100ad81941c967ce34cc7534bf9b6d7b585e91 Mon Sep 17 00:00:00 2001 From: green Date: Tue, 1 Apr 2025 23:12:21 +0200 Subject: check the extension in a different way --- format.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'format.c') diff --git a/format.c b/format.c index 43dd638..1bb2cf1 100644 --- a/format.c +++ b/format.c @@ -10,6 +10,7 @@ #include "xs_match.h" #include "snac.h" +#include /* emoticons, people laughing and such */ const char *smileys[] = { @@ -382,11 +383,11 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag const char *k, *v; while (xs_dict_next(d, &k, &v, &c)) { - const char *t = NULL; + const char *t = xs_mime_by_ext(v); /* is it an URL to an image? */ if (xs_startswith(v, "https:/" "/") && - (xs_startswith((t = xs_mime_by_ext(v)), "image/") || strrchr(v, '.') == NULL)) { + (xs_startswith(t, "image/") || strcmp(t, "application/octet-stream") == 0)) { if (tag && xs_str_in(s, k) != -1) { /* add the emoji to the tag list */ xs *e = xs_dict_new(); -- cgit v1.2.3 From 0c03e6c9d9a6b65fede94cc9eab34a05746f8d5e Mon Sep 17 00:00:00 2001 From: green Date: Sun, 13 Apr 2025 15:44:24 +0200 Subject: cleaned up old changes and outdated comments --- format.c | 1 - 1 file changed, 1 deletion(-) (limited to 'format.c') diff --git a/format.c b/format.c index 1bb2cf1..3089955 100644 --- a/format.c +++ b/format.c @@ -10,7 +10,6 @@ #include "xs_match.h" #include "snac.h" -#include /* emoticons, people laughing and such */ const char *smileys[] = { -- cgit v1.2.3