X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/7bd90b8048fd6937766dff7474947dd80205ea7e..30304d8156a72ffc95e45e1aa9407319b81bd253:/ui-snapshot.c diff --git a/ui-snapshot.c b/ui-snapshot.c index 7115ec4..cb34f4b 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -99,7 +99,7 @@ static const struct cgit_snapshot_format *get_format(const char *filename) const struct cgit_snapshot_format *fmt; for (fmt = cgit_snapshot_formats; fmt->suffix; fmt++) { - if (!suffixcmp(filename, fmt->suffix)) + if (ends_with(filename, fmt->suffix)) return fmt; } return NULL; @@ -119,9 +119,10 @@ static int make_snapshot(const struct cgit_snapshot_format *format, cgit_print_error("Not a commit reference: %s", hex); return 1; } + ctx.page.etag = sha1_to_hex(sha1); ctx.page.mimetype = xstrdup(format->mimetype); ctx.page.filename = xstrdup(filename); - cgit_print_http_headers(&ctx); + cgit_print_http_headers(); format->write_func(hex, prefix); return 0; } @@ -151,7 +152,7 @@ static const char *get_ref_from_filename(const char *url, const char *filename, goto out; reponame = cgit_repobasename(url); - if (prefixcmp(snapshot.buf, reponame) == 0) { + if (starts_with(snapshot.buf, reponame)) { const char *new_start = snapshot.buf; new_start += strlen(reponame); while (new_start && (*new_start == '-' || *new_start == '_')) @@ -183,9 +184,9 @@ static void show_error(char *fmt, ...) va_list ap; ctx.page.mimetype = "text/html"; - cgit_print_http_headers(&ctx); - cgit_print_docstart(&ctx); - cgit_print_pageheader(&ctx); + cgit_print_http_headers(); + cgit_print_docstart(); + cgit_print_pageheader(); va_start(ap, fmt); cgit_vprint_error(fmt, ap); va_end(ap); @@ -193,7 +194,7 @@ static void show_error(char *fmt, ...) } void cgit_print_snapshot(const char *head, const char *hex, - const char *filename, int snapshots, int dwim) + const char *filename, int dwim) { const struct cgit_snapshot_format* f; char *prefix = NULL;