ui-shared: currenturl should take into account leading slash

Este commit está contenido en:
Jason A. Donenfeld 2015-03-08 12:34:07 +01:00
padre 438bac6f57
commit 8eef4589d0
Se han modificado 1 ficheros con 5 adiciones y 1 borrados

Ver fichero

@ -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)