Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-clone.c | 25 |
1 file changed, 5 insertions, 20 deletions
diff --git a/source/ui-clone.c b/source/ui-clone.c index dad21d5..bdfbdf7 100644 --- a/source/ui-clone.c +++ b/source/ui-clone.c @@ -38,19 +38,6 @@ static int print_ref(const struct reference *ref, void *cb_data UNUSED) } /* - * A path ending in a slash is handed back whole, where git's own - * pack_basename would return the empty string. - */ -static const char *last_path_component(const char *path) -{ - const char *slash = strrchr(path, '/'); - - if (slash && slash[1] != '\0') - return slash + 1; - return path; -} - -/* * Only the packs this repository holds itself are listed, because one * borrowed from an alternate is not reachable below this URL and a client * told about it would come back for a file that is not there. @@ -74,7 +61,7 @@ static void print_pack_info(void) struct packed_git *pack = entry->pack; if (pack->pack_local) - htmlf("P %s\n", last_path_component(pack->pack_name)); + htmlf("P %s\n", pack_basename(pack)); } } } @@ -169,8 +156,10 @@ void cgit_clone_objects(void) { char *path; - if (!ctx.qry.path) - goto err; + if (!ctx.qry.path) { + cgit_print_error_page(400, "Bad Request", "Bad request"); + return; + } if (!strcmp(ctx.qry.path, "info/packs")) { print_pack_info(); @@ -185,10 +174,6 @@ void cgit_clone_objects(void) path = repo_git_path(the_repository, "objects/%s", ctx.qry.path); send_file(path); free(path); - return; - -err: - cgit_print_error_page(400, "Bad Request", "Bad request"); } /* |
