mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-10 19:54:08 +02:00
resources: Fix 2 image file cache key issues
* Always include the content hash in the cache key for unprocessed images. * Always include the image config hash in the cache key. This is also a major cleanup/simplification of the implementation in this area. Note that this, unfortunately, forces new hashes/filenames for generated images. Fixes #13273 Fixes #13272
This commit is contained in:
@@ -363,6 +363,7 @@ type genericResource struct {
|
||||
sd ResourceSourceDescriptor
|
||||
paths internal.ResourcePaths
|
||||
|
||||
includeHashInKey bool
|
||||
sourceFilenameIsHash bool
|
||||
|
||||
h *resourceHash // A hash of the source content. Is only calculated in caching situations.
|
||||
@@ -452,6 +453,10 @@ func (l *genericResource) Key() string {
|
||||
if l.spec.Cfg.IsMultihost() {
|
||||
l.key = l.spec.Lang() + l.key
|
||||
}
|
||||
|
||||
if l.includeHashInKey && !l.sourceFilenameIsHash {
|
||||
l.key += fmt.Sprintf("_%d", l.hash())
|
||||
}
|
||||
})
|
||||
|
||||
return l.key
|
||||
|
Reference in New Issue
Block a user