aboutsummaryrefslogtreecommitdiffstats
path: root/ui-clone.c
diff options
context:
space:
mode:
authorJason A. Donenfeld2015-02-09 12:27:44 +0100
committerJason A. Donenfeld2015-02-09 12:29:57 +0100
commit6e498de213aeebf63523ff0f298c2ae6393f9c0f (patch)
tree689122afcac6b3e1ffa83837f4eb6dd96641d1e5 /ui-clone.c
parentb66b16ed026c6f57ad8ae892c821d835113e7fb2 (diff)
downloadcgit-6e498de213aeebf63523ff0f298c2ae6393f9c0f.tar.gz
cgit-6e498de213aeebf63523ff0f298c2ae6393f9c0f.tar.bz2
cgit-6e498de213aeebf63523ff0f298c2ae6393f9c0f.zip
ui-clone.c: Fix off-by-one error in pack path
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui-clone.c')
-rw-r--r--ui-clone.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ui-clone.c b/ui-clone.c
index 1e6238d..e35d3d3 100644
--- a/ui-clone.c
+++ b/ui-clone.c
@@ -32,16 +32,22 @@ static int print_ref_info(const char *refname, const unsigned char *sha1,
32static void print_pack_info(void) 32static void print_pack_info(void)
33{ 33{
34 struct packed_git *pack; 34 struct packed_git *pack;
35 int ofs; 35 char *offset;
36 36
37 ctx.page.mimetype = "text/plain"; 37 ctx.page.mimetype = "text/plain";
38 ctx.page.filename = "objects/info/packs"; 38 ctx.page.filename = "objects/info/packs";
39 cgit_print_http_headers(); 39 cgit_print_http_headers();
40 ofs = strlen(ctx.repo->path) + strlen("/objects/pack/");
41 prepare_packed_git(); 40 prepare_packed_git();
42 for (pack = packed_git; pack; pack = pack->next) 41 for (pack = packed_git; pack; pack = pack->next) {
43 if (pack->pack_local) 42 if (pack->pack_local) {
44 htmlf("P %s\n", pack->pack_name + ofs); 43 offset = strrchr(pack->pack_name, '/');
44 if (offset && offset[1] != '\0')
45 ++offset;
46 else
47 offset = pack->pack_name;
48 htmlf("P %s\n", offset);
49 }
50 }
45} 51}
46 52
47static void send_file(char *path) 53static void send_file(char *path)