about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-05-16 02:06:28 +0200
committerLars Hjemli <hjemli@gmail.com>2007-05-16 02:06:28 +0200
commit723469962b42de9f73960a883403cfdc422f176f (patch)
tree6f0090acb7ba5f79524197ec2e8419c8556d8fac
parentAdd support for tree listing via h parameter (diff)
downloadcgit-pink-723469962b42de9f73960a883403cfdc422f176f.tar.gz
cgit-pink-723469962b42de9f73960a883403cfdc422f176f.zip
Make git_pageurl handle NULL querystrings
This is suddenly useful after the repo.defbranch-related changes.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--ui-shared.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c
index b0cff7d..6211056 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -61,8 +61,12 @@ char *cgit_pageurl(const char *reponame, const char *pagename,
 		   const char *query)
 {
 	if (cgit_virtual_root) {
-		return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame,
-			   pagename, query);
+		if (query)
+			return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame,
+				   pagename, query);
+		else
+			return fmt("%s/%s/%s/", cgit_virtual_root, reponame,
+				   pagename);
 	} else {
 		return fmt("?r=%s&p=%s&%s", reponame, pagename, query);
 	}