From 15576405b67339148197dee2edbd1c6b6a495ba3 Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Thu, 12 Mar 2026 23:00:12 +0100 Subject: http: no content-disposition for pictures & videos (open them in browser) --- http.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index 4dbeff2..b28565e 100644 --- a/http.c +++ b/http.c @@ -53,7 +53,12 @@ http_open_file(struct kreq * r, enum khttp code, const struct file * f) return false; khttp_head(r, kresps[KRESP_STATUS], "%s", khttps[code]); - khttp_head(r, kresps[KRESP_CONTENT_DISPOSITION], + + /* no content-disposition for pictures & videos (open them in browser) */ + if (f->mime != MIME_GIF && f->mime != MIME_JPG && f->mime != MIME_MP4 && + f->mime != MIME_PNG && f->mime != MIME_SVG && f->mime != MIME_WEBM && + f->mime != MIME_WEBP) + khttp_head(r, kresps[KRESP_CONTENT_DISPOSITION], "attachment;filename=\"%s\"", filename); free(filename); khttp_head(r, kresps[KRESP_CONTENT_TYPE], "%s", mime_str(f->mime)); -- cgit v1.2.3