mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
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:
4
cache/filecache/filecache_config.go
vendored
4
cache/filecache/filecache_config.go
vendored
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user