mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 08:28:42 +00:00
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:
parent
b8be028a30
commit
7d6ee4ee8a
10
cgit.c
10
cgit.c
@ -29,13 +29,15 @@ 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),
|
||||||
cache_safe_filename(cgit_querystring)));
|
cgit_query_page,
|
||||||
|
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;
|
||||||
else if (cgit_query_has_sha1)
|
else if (cgit_query_has_sha1)
|
||||||
|
Loading…
Reference in New Issue
Block a user