cache/filecache: Add a filecache root dir

This is just a safe guard to make sure we don't evict/remove files that do not belong to the cache.
This commit is contained in:
Bjørn Erik Pedersen
2018-11-14 11:53:45 +01:00
parent d3489eba5d
commit 33502667fb
5 changed files with 38 additions and 3 deletions

View File

@@ -157,6 +157,10 @@ func decodeConfig(p *paths.Paths) (cachesConfig, error) {
return c, errors.Errorf("%q must either start with a placeholder (e.g. :cacheDir, :resourceDir) or be absolute", v.Dir)
}
if len(v.Dir) < 5 {
return c, errors.Errorf("%q is not a valid cache dir", v.Dir)
}
if disabled {
v.MaxAge = 0
}