Include querystring as part of cached filename for repo summary page

When adding support for the h parameter to the summary page (passing current
branch between pages), the builtin cache returned basically random results
for summary page since the cached filename didn't honour the querystring.

This fixes the issue for now, but someday it might be worthwhile to generate
'canonical' filenames in the cache for all pages, i.e. something a bit more
clever than just including the querystring.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Lars Hjemli 2007-06-18 21:17:24 +02:00
parent b8be028a30
commit 7d6ee4ee8a

8
cgit.c
View File

@ -29,12 +29,14 @@ static int cgit_prepare_cache(struct cacheitem *item)
} }
if (!cgit_cmd) { if (!cgit_cmd) {
item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root, item->name = xstrdup(fmt("%s/%s/index.%s.html", cgit_cache_root,
cache_safe_filename(cgit_repo->url))); cache_safe_filename(cgit_repo->url),
cache_safe_filename(cgit_querystring)));
item->ttl = cgit_cache_repo_ttl; item->ttl = cgit_cache_repo_ttl;
} else { } else {
item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root, item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
cache_safe_filename(cgit_repo->url), cgit_query_page, cache_safe_filename(cgit_repo->url),
cgit_query_page,
cache_safe_filename(cgit_querystring))); cache_safe_filename(cgit_querystring)));
if (cgit_query_has_symref) if (cgit_query_has_symref)
item->ttl = cgit_cache_dynamic_ttl; item->ttl = cgit_cache_dynamic_ttl;