summaryrefslogtreecommitdiffabout
path: root/cgit.c
Side-by-side diff
Diffstat (limited to 'cgit.c') (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index d975570..a3a04d9 100644
--- a/cgit.c
+++ b/cgit.c
@@ -1,49 +1,49 @@
/* cgit.c: cgi for the git scm
*
* Copyright (C) 2006 Lars Hjemli
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
const char cgit_version[] = CGIT_VERSION;
static void cgit_prepare_cache(struct cacheitem *item)
{
if (!cgit_query_repo) {
item->name = xstrdup(fmt("%s/index.html", cgit_cache_root));
item->ttl = cgit_cache_root_ttl;
} else if (!cgit_query_page) {
item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root,
cgit_query_repo));
item->ttl = cgit_cache_repo_ttl;
} else {
item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
cgit_query_repo, cgit_query_page,
- cgit_querystring));
+ cache_safe_filename(cgit_querystring)));
if (cgit_query_has_symref)
item->ttl = cgit_cache_dynamic_ttl;
else if (cgit_query_has_sha1)
item->ttl = cgit_cache_static_ttl;
else
item->ttl = cgit_cache_repo_ttl;
}
}
static void cgit_print_repo_page(struct cacheitem *item)
{
if (chdir(fmt("%s/%s", cgit_root, cgit_query_repo)) ||
cgit_read_config("info/cgit", cgit_repo_config_cb)) {
char *title = fmt("%s - %s", cgit_root_title, "Bad request");
cgit_print_docstart(title, item);
cgit_print_pageheader(title, 0);
cgit_print_error(fmt("Unable to scan repository: %s",
strerror(errno)));
cgit_print_docend();
return;
}
setenv("GIT_DIR", fmt("%s/%s", cgit_root, cgit_query_repo), 1);
char *title = fmt("%s - %s", cgit_repo_name, cgit_repo_desc);
int show_search = 0;