-rw-r--r-- | ui-snapshot.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 966a140..7a597ff 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -77,17 +77,23 @@ static int make_snapshot(const struct cgit_snapshot_format *format, | |||
77 | return 1; | 77 | return 1; |
78 | } | 78 | } |
79 | commit = lookup_commit_reference(sha1); | 79 | commit = lookup_commit_reference(sha1); |
80 | if(!commit) { | 80 | if(!commit) { |
81 | cgit_print_error(fmt("Not a commit reference: %s", hex)); | 81 | cgit_print_error(fmt("Not a commit reference: %s", hex)); |
82 | return 1; | 82 | return 1; |
83 | } | 83 | } |
84 | memset(&args, 0, sizeof(args)); | 84 | memset(&args, 0, sizeof(args)); |
85 | args.base = fmt("%s/", prefix); | 85 | if (prefix) { |
86 | args.base = fmt("%s/", prefix); | ||
87 | args.baselen = strlen(prefix) + 1; | ||
88 | } else { | ||
89 | args.base = ""; | ||
90 | args.baselen = 0; | ||
91 | } | ||
86 | args.tree = commit->tree; | 92 | args.tree = commit->tree; |
87 | args.time = commit->date; | 93 | args.time = commit->date; |
88 | ctx.page.mimetype = xstrdup(format->mimetype); | 94 | ctx.page.mimetype = xstrdup(format->mimetype); |
89 | ctx.page.filename = xstrdup(filename); | 95 | ctx.page.filename = xstrdup(filename); |
90 | cgit_print_http_headers(&ctx); | 96 | cgit_print_http_headers(&ctx); |
91 | format->write_func(&args); | 97 | format->write_func(&args); |
92 | return 0; | 98 | return 0; |
93 | } | 99 | } |