void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
const char *separator)
{
- const struct cgit_snapshot_format* f;
+ const struct cgit_snapshot_format *f;
struct strbuf filename = STRBUF_INIT;
const char *basename;
size_t prefixlen;
cgit_snapshot_link("sig", NULL, NULL, NULL, NULL,
filename.buf);
html(")");
+ } else if (starts_with(f->suffix, ".tar") && cgit_snapshot_get_sig(ref, &cgit_snapshot_formats[0])) {
+ strbuf_setlen(&filename, strlen(filename.buf) - strlen(f->suffix));
+ strbuf_addstr(&filename, ".tar.asc");
+ html(" (");
+ cgit_snapshot_link("sig", NULL, NULL, NULL, NULL,
+ filename.buf);
+ html(")");
}
html(separator);
}
}
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 },
}
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;