diff options
| author | 2025-04-01 23:12:21 +0200 | |
|---|---|---|
| committer | 2025-04-13 14:42:02 +0200 | |
| commit | 15100ad81941c967ce34cc7534bf9b6d7b585e91 (patch) | |
| tree | 13e81835d914b073d04362d6d605b00cb7ef8459 | |
| parent | allow emoji urls with no extension (diff) | |
| download | penes-snac2-15100ad81941c967ce34cc7534bf9b6d7b585e91.tar.gz penes-snac2-15100ad81941c967ce34cc7534bf9b6d7b585e91.tar.xz penes-snac2-15100ad81941c967ce34cc7534bf9b6d7b585e91.zip | |
check the extension in a different way
| -rw-r--r-- | format.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "xs_match.h" | 10 | #include "xs_match.h" |
| 11 | 11 | ||
| 12 | #include "snac.h" | 12 | #include "snac.h" |
| 13 | #include <string.h> | ||
| 13 | 14 | ||
| 14 | /* emoticons, people laughing and such */ | 15 | /* emoticons, people laughing and such */ |
| 15 | const char *smileys[] = { | 16 | const char *smileys[] = { |
| @@ -382,11 +383,11 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag | |||
| 382 | const char *k, *v; | 383 | const char *k, *v; |
| 383 | 384 | ||
| 384 | while (xs_dict_next(d, &k, &v, &c)) { | 385 | while (xs_dict_next(d, &k, &v, &c)) { |
| 385 | const char *t = NULL; | 386 | const char *t = xs_mime_by_ext(v); |
| 386 | 387 | ||
| 387 | /* is it an URL to an image? */ | 388 | /* is it an URL to an image? */ |
| 388 | if (xs_startswith(v, "https:/" "/") && | 389 | if (xs_startswith(v, "https:/" "/") && |
| 389 | (xs_startswith((t = xs_mime_by_ext(v)), "image/") || strrchr(v, '.') == NULL)) { | 390 | (xs_startswith(t, "image/") || strcmp(t, "application/octet-stream") == 0)) { |
| 390 | if (tag && xs_str_in(s, k) != -1) { | 391 | if (tag && xs_str_in(s, k) != -1) { |
| 391 | /* add the emoji to the tag list */ | 392 | /* add the emoji to the tag list */ |
| 392 | xs *e = xs_dict_new(); | 393 | xs *e = xs_dict_new(); |