commit 15100ad

green  ·  2025-04-01 21:12:21 +0000 UTC
parent e251c61
check the extension in a different way
1 files changed,  +3, -2
+3, -2
 1@@ -10,6 +10,7 @@
 2 #include "xs_match.h"
 3 
 4 #include "snac.h"
 5+#include <string.h>
 6 
 7 /* emoticons, people laughing and such */
 8 const char *smileys[] = {
 9@@ -382,11 +383,11 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag
10         const char *k, *v;
11 
12         while (xs_dict_next(d, &k, &v, &c)) {
13-            const char *t = NULL;
14+            const char *t = xs_mime_by_ext(v);
15 
16             /* is it an URL to an image? */
17             if (xs_startswith(v, "https:/" "/") &&
18-                (xs_startswith((t = xs_mime_by_ext(v)), "image/") || strrchr(v, '.') == NULL)) {
19+                (xs_startswith(t, "image/") || strcmp(t, "application/octet-stream") == 0)) {
20                 if (tag && xs_str_in(s, k) != -1) {
21                     /* add the emoji to the tag list */
22                     xs *e = xs_dict_new();