diff options
author | Jason A. Donenfeld | 2015-03-08 12:34:07 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2015-03-09 17:42:02 +0100 |
commit | 8eef4589d0ba80fd4e6a9ce2f3ca4fcf266a64e0 (patch) | |
tree | 048296d0b760372a8f2eaf9ff8379c068e00411e | |
parent | html: avoid using a plain integer as a NULL pointer (diff) | |
download | cgit-8eef4589d0ba80fd4e6a9ce2f3ca4fcf266a64e0.tar.gz cgit-8eef4589d0ba80fd4e6a9ce2f3ca4fcf266a64e0.zip |
ui-shared: currenturl should take into account leading slash
-rw-r--r-- | ui-shared.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c index 7bcb8d3..23a893b 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -69,7 +69,11 @@ const char *cgit_currenturl(void) | |||
69 | { | 69 | { |
70 | if (!ctx.qry.url) | 70 | if (!ctx.qry.url) |
71 | return cgit_rooturl(); | 71 | return cgit_rooturl(); |
72 | return ctx.qry.url; | 72 | const char *root = cgit_rooturl(); |
73 | size_t len = strlen(root); | ||
74 | if (len && root[len - 1] == '/') | ||
75 | return fmtalloc("%s%s", root, ctx.qry.url); | ||
76 | return fmtalloc("%s/%s", root, ctx.qry.url); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | const char *cgit_rooturl(void) | 79 | const char *cgit_rooturl(void) |