aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreen <dandelions@disroot.org>2025-04-01 23:12:21 +0200
committergreen <dandelions@disroot.org>2025-04-13 14:42:02 +0200
commit15100ad81941c967ce34cc7534bf9b6d7b585e91 (patch)
tree13e81835d914b073d04362d6d605b00cb7ef8459
parente251c61382d4cd39ed89876a37962acab1122f84 (diff)
check the extension in a different way
-rw-r--r--format.c5
1 files changed, 3 insertions, 2 deletions
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 <string.h>
/* 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();