]> git.cameronkatri.com Git - cgit.git/blobdiff - cmd.c
shared: remove return value from cgit_free_commitinfo()
[cgit.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index 3093c62a5f1fc581e35d86c0d2f265cf0e4b4091..d280e95fb0928b853fdf33ad68edcd56273d9018 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -39,16 +39,26 @@ static void atom_fn(void)
 static void about_fn(void)
 {
        if (ctx.repo) {
+               size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0;
                if (!ctx.qry.path &&
                    ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' &&
-                   ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') {
+                   (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) {
                        char *currenturl = cgit_currenturl();
                        char *redirect = fmtalloc("%s/", currenturl);
                        cgit_redirect(redirect, true);
                        free(currenturl);
                        free(redirect);
-               } else
+               } else if (ctx.repo->readme.nr)
                        cgit_print_repo_readme(ctx.qry.path);
+               else if (ctx.repo->homepage)
+                       cgit_redirect(ctx.repo->homepage, false);
+               else {
+                       char *currenturl = cgit_currenturl();
+                       char *redirect = fmtalloc("%s../", currenturl);
+                       cgit_redirect(redirect, false);
+                       free(currenturl);
+                       free(redirect);
+               }
        } else
                cgit_print_site_readme();
 }