Diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/ui-snapshot.c | 20 |
1 file changed, 9 insertions, 11 deletions
diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 0d8ecdf..ffd0b0b 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -224,18 +224,18 @@ static const char *ref_from_filename(const struct cgit_repo *repo, const char *f return found ? strbuf_detach(&rev, NULL) : NULL; } -static int send_snapshot(const struct cgit_snapshot_format *format, const char *hex, +static void send_snapshot(const struct cgit_snapshot_format *format, const char *hex, const char *prefix, const char *filename) { struct object_id oid; if (repo_get_oid(the_repository, hex, &oid)) { cgit_print_error_page(404, "Not Found", "Bad object id: %s", hex); - return 1; + return; } if (!lookup_commit_reference(the_repository, &oid)) { cgit_print_error_page(404, "Not Found", "Not a commit: %s", hex); - return 1; + return; } // A compressor that cannot run only shows up as a broken pipe once // the tar is under way, so it is looked for while a status can still @@ -243,7 +243,7 @@ static int send_snapshot(const struct cgit_snapshot_format *format, const char * if (format->compressor && !program_on_path(format->compressor[0])) { cgit_print_error_page(500, "Internal Server Error", "Unable to run %s", format->compressor[0]); - return 1; + return; } ctx.page.mimetype = xstrdup(format->mimetype); ctx.page.filename = xstrdup(filename); @@ -252,10 +252,9 @@ static int send_snapshot(const struct cgit_snapshot_format *format, const char * // The archiver reads its arguments as a command line, so it gets the // resolved id and never the name. write_snapshot(format, oid_to_hex(&oid), prefix); - return 0; } -static int send_sig(const struct cgit_snapshot_format *format, const char *hex, +static void send_sig(const struct cgit_snapshot_format *format, const char *hex, const char *archive_name, const char *sig_filename) { const struct object_id *note = cgit_snapshot_get_sig(hex, format); @@ -265,24 +264,24 @@ static int send_sig(const struct cgit_snapshot_format *format, const char *hex, if (!note) { cgit_print_error_page(404, "Not Found", "No signature for %s", archive_name); - return 0; + return; } // A note is any blob a pusher stored, so it is held to the same bound // as every other blob a page inflates. if (odb_read_object_info(the_repository->objects, note, &size) != OBJ_BLOB) { cgit_print_error_page(404, "Not Found", "Not found"); - return 0; + return; } if (cgit_blob_too_large(size)) { cgit_print_blob_too_large(size); - return 0; + return; } buf = odb_read_object(the_repository->objects, note, &type, &size); if (!buf) { cgit_print_error_page(404, "Not Found", "Not found"); - return 0; + return; } ctx.page.untrusted = 1; @@ -292,7 +291,6 @@ static int send_sig(const struct cgit_snapshot_format *format, const char *hex, html_raw(buf, size); free(buf); - return 0; } const struct object_id *cgit_snapshot_get_sig(const char *ref, const struct cgit_snapshot_format *f) |
