Commit Diff


commit - 5bf64361d0703410f1b9ff9479cb21f0d384bc26d8b3f5f6531a419dcb842c2b
commit + e6d36501363aaa83462dc324e7593e8e913a790d91c3e638322410833a1bfd84
blob - b76288df2e01cc498785943df61a2af37bcf22d13a51bf01a2b6ccf3452fa990
blob + 8c1b73c4cb0672342907d9ff0975e54b37e95d45ba1553e52a3c18ed5cd8d199
--- gotwebd/pages.tmpl	
+++ gotwebd/pages.tmpl	
@@ -172,9 +172,27 @@ nextsep(char *s, char **t)
 	struct gotweb_url	 u_path;
 	char			 prefix[MAX_DOCUMENT_URI * 2];
 	const char		*css = srv->custom_css;
+	const char		*url_root, *url_path;
 
-	strlcpy(prefix, srv->gotweb_url_root, sizeof(prefix));
-	strlcat(prefix, srv->repos_url_path, sizeof(prefix));
+	strlcpy(prefix, "/", sizeof(prefix));
+
+	url_root = srv->gotweb_url_root;
+	while (url_root[0] == '/')
+		url_root++;
+	if (url_root[0] != '\0')
+		strlcat(prefix, url_root, sizeof(prefix));
+
+	url_path = srv->repos_url_path;
+	while (url_path[0] == '/')
+		url_path++;
+	if (url_path[0] != '\0') {
+		if (url_root[0] != '\0') {
+			got_path_strip_trailing_slashes(prefix);
+			strlcat(prefix, "/", sizeof(prefix));
+		}
+		strlcat(prefix, url_path, sizeof(prefix));
+	}
+
 	got_path_strip_trailing_slashes(prefix);
 
 	memset(&u_path, 0, sizeof(u_path));