aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-07-12 09:22:30 +0200
committerlookshe <github@lookshe.org>2016-07-12 09:22:30 +0200
commit1787404b6a618d07200db241c004d1bedc92f874 (patch)
treeaff8c654e8f3190210f80b4c886ee5a8e88e26fd /cmd.c
parent2209fe5157b431cf57898deb889acdcc704dda64 (diff)
parent40fbefba0514b33988d453aea05aa2b956e98f84 (diff)
Merge branch 'master' into lookshe/masterlookshe/master
Conflicts: filters/html-converters/md2html
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index 3093c62..d280e95 100644
--- 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();
}