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
orang tua b8be028a30
melakukan 7d6ee4ee8a

10
cgit.c
Melihat File

@ -29,13 +29,15 @@ static int cgit_prepare_cache(struct cacheitem *item)
}
if (!cgit_cmd) {
item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root,
cache_safe_filename(cgit_repo->url)));
item->name = xstrdup(fmt("%s/%s/index.%s.html", cgit_cache_root,
cache_safe_filename(cgit_repo->url),
cache_safe_filename(cgit_querystring)));
item->ttl = cgit_cache_repo_ttl;
} else {
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_querystring)));
cache_safe_filename(cgit_repo->url),
cgit_query_page,
cache_safe_filename(cgit_querystring)));
if (cgit_query_has_symref)
item->ttl = cgit_cache_dynamic_ttl;
else if (cgit_query_has_sha1)