]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-snapshot.c
Fix gcc 8.1.1 compiler warnings
[cgit.git] / ui-snapshot.c
index 83ce6e86243fd3105f24bef20a71924a0e8173e0..fa3ceafe65473a015f4a0ff0e6d97b9dcfc54677 100644 (file)
@@ -86,6 +86,7 @@ static int write_tar_xz_archive(const char *hex, const char *prefix)
 }
 
 const struct cgit_snapshot_format cgit_snapshot_formats[] = {
+       /* .tar must remain the 0 index */
        { ".tar",       "application/x-tar",    write_tar_archive       },
        { ".tar.gz",    "application/x-gzip",   write_tar_gzip_archive  },
        { ".tar.bz2",   "application/x-bzip2",  write_tar_bzip2_archive },
@@ -174,7 +175,7 @@ static int write_sig(const struct cgit_snapshot_format *format,
                return 0;
        }
 
-       buf = read_sha1_file(note->hash, &type, &size);
+       buf = read_object_file(note, &type, &size);
        if (!buf) {
                cgit_print_error_page(404, "Not found", "Not found");
                return 0;
@@ -268,7 +269,7 @@ void cgit_print_snapshot(const char *head, const char *hex,
        }
 
        f = get_format(filename);
-       if (!f || !(ctx.repo->snapshots & cgit_snapshot_format_bit(f))) {
+       if (!f || (!sig_filename && !(ctx.repo->snapshots & cgit_snapshot_format_bit(f)))) {
                cgit_print_error_page(400, "Bad request",
                                "Unsupported snapshot format: %s", filename);
                return;