neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit 8eef4589d0ba80fd4e6a9ce2f3ca4fcf266a64e0
parent 438bac6f579dab5b8f64e8ce42b88cfc3f053b28
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sun,  8 Mar 2015 12:34:07 +0100

ui-shared: currenturl should take into account leading slash

Diffstat:
Mui-shared.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ui-shared.c b/ui-shared.c @@ -69,7 +69,11 @@ const char *cgit_currenturl(void) { if (!ctx.qry.url) return cgit_rooturl(); - return ctx.qry.url; + const char *root = cgit_rooturl(); + size_t len = strlen(root); + if (len && root[len - 1] == '/') + return fmtalloc("%s%s", root, ctx.qry.url); + return fmtalloc("%s/%s", root, ctx.qry.url); } const char *cgit_rooturl(void)