X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/d34b96719053ff9340519b64f6d970caaa64350d..121e65391446069a538ae8d3f7938452178de7c6:/ui-shared.c
diff --git a/ui-shared.c b/ui-shared.c
index 7bcb8d3..ac5a287 100644
--- 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)
@@ -555,25 +559,32 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
item = lookup_path(list, path);
}
}
- html("util, rev);
- } else if (ctx.repo->module_link) {
- dir = strrchr(path, '/');
- if (dir)
- dir++;
- else
- dir = path;
- html_attrf(ctx.repo->module_link, dir, rev);
+ if (item || ctx.repo->module_link) {
+ html("util, rev);
+ } else {
+ dir = strrchr(path, '/');
+ if (dir)
+ dir++;
+ else
+ dir = path;
+ html_attrf(ctx.repo->module_link, dir, rev);
+ }
+ html("'>");
+ html_txt(path);
+ html("");
} else {
- html("#");
+ html("");
+ html_txt(path);
+ html("");
}
- html("'>");
- html_txt(path);
- html("");
html_txtf(" @ %.7s", rev);
if (item && tail)
path[len - 1] = tail;
@@ -884,6 +895,8 @@ static void print_header(void)
cgit_add_hidden_formfields(0, 1, ctx.qry.page);
html(" ");
html("");
html("");