about: path_info might not be valid
This commit is contained in:
parent
c424b5cb02
commit
09a3aa5ae7
3
cmd.c
3
cmd.c
@ -39,9 +39,10 @@ static void atom_fn(void)
|
|||||||
static void about_fn(void)
|
static void about_fn(void)
|
||||||
{
|
{
|
||||||
if (ctx.repo) {
|
if (ctx.repo) {
|
||||||
|
size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0;
|
||||||
if (!ctx.qry.path &&
|
if (!ctx.qry.path &&
|
||||||
ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' &&
|
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 *currenturl = cgit_currenturl();
|
||||||
char *redirect = fmtalloc("%s/", currenturl);
|
char *redirect = fmtalloc("%s/", currenturl);
|
||||||
cgit_redirect(redirect, true);
|
cgit_redirect(redirect, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user