From 1f820ce8f0c8ce6df5bdc072775ea631ca403960 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 23 Dec 2025 23:35:54 +0100 Subject: redirect links without command (/git//a/b.c) to /git//tree/a/b.c --- cmd.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- cgit v1.2.3