diff options
| author | Vincent Douillet <vincent@vdouillet.fr> | 2026-03-12 23:00:12 +0100 |
|---|---|---|
| committer | Vincent Douillet <vincent@vdouillet.fr> | 2026-03-12 23:01:04 +0100 |
| commit | 15576405b67339148197dee2edbd1c6b6a495ba3 (patch) | |
| tree | ab388309d0b28320ac86eae886c8163f90fc739c /http.c | |
| parent | 4d3dca2af0500bdca863355ac318d8f870158c2d (diff) | |
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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)); |
