Procházet zdrojové kódy

check the extension in a different way

green před 1 rokem
rodič
revize
15100ad819
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 3 2
      format.c

+ 3 - 2
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();