about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2018-06-07 21:31:28 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-03 20:37:44 +0200
commit7ba41963dde175581ae7b395045fd51678237930 (patch)
tree72df4e03388644a243d3a4d18b055f45b707d860 /ui-shared.c
parentextra-head-content: introduce another option for meta tags (diff)
downloadcgit-pink-7ba41963dde175581ae7b395045fd51678237930.tar.gz
cgit-pink-7ba41963dde175581ae7b395045fd51678237930.zip
snapshot: support tar signature for compressed tar
This adds support for kernel.org style signatures where the uncompressed
tar archive is signed and compressed later. The signature is valid for
all tar* snapshots.

We have a filter which snapshots may be generated and downloaded. This has
to allow tar signatures now even if tar itself is not allowed. To simplify
things we allow all signatures.

Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to '')
-rw-r--r--ui-shared.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 9a2e382..066a470 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -1114,7 +1114,7 @@ void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base,
 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;
@@ -1139,6 +1139,13 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
 			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);
 	}