abouttreesummaryrefslogcommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorPatrick2025-12-23 23:35:54 +0100
committerPatrick2025-12-23 23:35:54 +0100
commit1f820ce8f0c8ce6df5bdc072775ea631ca403960 (patch)
tree39109d58b12ae2da5e54d9fb62530f85ee99d65b /cmd.c
parent7dfc2b975fd4a735073536914f5a49b8d80a1104 (diff)
downloadps-cgit-1f820ce8f0c8ce6df5bdc072775ea631ca403960.tar.gz
ps-cgit-1f820ce8f0c8ce6df5bdc072775ea631ca403960.zip
redirect links without command (/git/<repo>/a/b.c) to /git/<repo>/tree/a/b.c
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd.c b/cmd.c
index 4887d18..e75c313 100644
--- a/cmd.c
+++ b/cmd.c
@@ -204,5 +204,10 @@ struct cgit_cmd *cgit_get_cmd(void)
for (i = 0; i < sizeof(cmds)/sizeof(*cmds); i++)
if (!strcmp(ctx.qry.page, cmds[i].name))
return &cmds[i];
+
+ char *redirect = fmtalloc("/git/%s/tree/%s%s%s", ctx.qry.repo, ctx.qry.page, ctx.qry.path ? "/" : "", ctx.qry.path ? ctx.qry.path : "");
+ cgit_redirect(redirect, false);
+ free(redirect);
+
return NULL;
}