diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-22 16:33:49 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-22 18:40:15 +0100 |
commit | 94c02bbf732d938c92df4961026c4d8f6fd4c37e (patch) | |
tree | ebab72fb96cf3fcd3de23078173c14f5dd7c7f58 | |
parent | 5f2664f13c90f083b827d8fafa6cfc01c0c4f513 (diff) | |
download | cgit-94c02bbf732d938c92df4961026c4d8f6fd4c37e.tar.gz cgit-94c02bbf732d938c92df4961026c4d8f6fd4c37e.tar.xz |
cmd: redirect empty about/ to homepage or summary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | cmd.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -47,8 +47,17 @@ static void about_fn(void) 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(); } |