From 6e96170cad16dc1ffbc320ac127c87ae2545873d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 27 Aug 2026 05:34:20 -1000 Subject: Use registered snapshot MIME types --- source/ui-snapshot.c | 6 +++--- tests/t0110-snapshot.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 3880f43..c3cb27a 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -111,12 +111,12 @@ static int write_tar_zstd_archive(const char *hex, const char *prefix) // tar variant, so this order cannot change. const struct cgit_snapshot_format cgit_snapshot_formats[] = { { ".tar", "application/x-tar", write_tar_archive }, - { ".tar.gz", "application/x-gzip", write_tar_gzip_archive }, + { ".tar.gz", "application/gzip", write_tar_gzip_archive }, { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive }, { ".tar.lz", "application/x-lzip", write_tar_lzip_archive }, { ".tar.xz", "application/x-xz", write_tar_xz_archive }, - { ".tar.zst", "application/x-zstd", write_tar_zstd_archive }, - { ".zip", "application/x-zip", write_zip_archive }, + { ".tar.zst", "application/zstd", write_tar_zstd_archive }, + { ".zip", "application/zip", write_zip_archive }, { NULL } }; diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh index d6c3265..9dc177f 100755 --- a/tests/t0110-snapshot.sh +++ b/tests/t0110-snapshot.sh @@ -75,11 +75,11 @@ test_expect_success 'untar and verify the content' ' test_line_count = 1 master/file-5 ' -test_tar_snapshot tar.gz application/x-gzip gzip GZIP +test_tar_snapshot tar.gz application/gzip gzip GZIP test_tar_snapshot tar.bz2 application/x-bzip2 bzip2 BZIP2 test_tar_snapshot tar.lz application/x-lzip lzip LZIP test_tar_snapshot tar.xz application/x-xz xz XZ -test_tar_snapshot tar.zst application/x-zstd zstd ZSTD +test_tar_snapshot tar.zst application/zstd zstd ZSTD if command -v unzip >/dev/null 2>&1 then @@ -94,7 +94,7 @@ test_expect_success 'get foo/snapshot/master.zip' ' test_expect_success 'check zip response headers' ' head -n 1 tmp | grep "Status: 200 OK" && - head -n 2 tmp | grep "Content-Type: application/x-zip" && + head -n 2 tmp | grep "Content-Type: application/zip" && head -n 3 tmp | grep "Content-Disposition: inline; filename=.master.zip." ' -- cgit v2.8.0