aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreen <dandelions@disroot.org>2025-03-26 01:40:14 +0100
committergreen <dandelions@disroot.org>2025-04-13 14:41:34 +0200
commitfbd81b604315f569ce5714fdc9d3caa78daaa83a (patch)
treec8ccfe6ecfccc33fea7584f38fa5210a17a69faa
parent4408859f8dcb8f83670d75f1128e1120ea318ec9 (diff)
mime types for apng and svg check
-rw-r--r--html.c10
-rw-r--r--xs_mime.h1
2 files changed, 4 insertions, 7 deletions
diff --git a/html.c b/html.c
index 103ce3d..c8015a1 100644
--- a/html.c
+++ b/html.c
@@ -95,14 +95,10 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
// on akkoma instances mediaType is not present.
// but we need to to know if the image is an svg or not.
// for now, i just use the file extention, which may not be the most reliable...
- int is_svg = 0;
- if (xs_is_string(mt)) {
- is_svg = (strcmp(mt, "image/svg+xml") == 0);
- } else {
- is_svg = xs_endswith(u, ".svg");
- }
+ if (!xs_is_string(mt))
+ mt = xs_mime_by_ext(u);
- if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
+ if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
s = xs_replace_i(s, n, "");
else {
xs *url = make_url(u, proxy, 0);
diff --git a/xs_mime.h b/xs_mime.h
index 6f65382..5f70922 100644
--- a/xs_mime.h
+++ b/xs_mime.h
@@ -38,6 +38,7 @@ const char *xs_mime_types[] = {
"ogv", "video/ogg",
"opus", "audio/ogg",
"png", "image/png",
+ "apng", "image/apng",
"svg", "image/svg+xml",
"svgz", "image/svg+xml",
"txt", "text/plain",