author | Lars Hjemli <hjemli@gmail.com> | 2007-05-16 00:06:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-16 00:06:28 (UTC) |
commit | 723469962b42de9f73960a883403cfdc422f176f (patch) (side-by-side diff) | |
tree | 6f0090acb7ba5f79524197ec2e8419c8556d8fac /ui-shared.c | |
parent | 97de8f0554649544c78aeb35a4c3431f17667ec5 (diff) | |
download | cgit-723469962b42de9f73960a883403cfdc422f176f.zip cgit-723469962b42de9f73960a883403cfdc422f176f.tar.gz cgit-723469962b42de9f73960a883403cfdc422f176f.tar.bz2 |
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index b0cff7d..6211056 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -40,50 +40,54 @@ void cgit_print_error(char *msg) html("</div>\n"); } char *cgit_rooturl() { if (cgit_virtual_root) return fmt("%s/", cgit_virtual_root); else return cgit_script_name; } char *cgit_repourl(const char *reponame) { if (cgit_virtual_root) { return fmt("%s/%s/", cgit_virtual_root, reponame); } else { return fmt("?r=%s", reponame); } } char *cgit_pageurl(const char *reponame, const char *pagename, const char *query) { if (cgit_virtual_root) { + 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); } } char *cgit_currurl() { if (!cgit_virtual_root) return cgit_script_name; else if (cgit_query_page) return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); else if (cgit_query_repo) return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo); else return fmt("%s/", cgit_virtual_root); } void cgit_print_date(unsigned long secs) { char buf[32]; struct tm *time; time = gmtime(&secs); |