mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
resources: Re-publish on transformation cache hit
When a resource transformation result was served from cache (same options as a previous build), the output file was not re-written to disk. This caused incorrect output when toggling transformation options (e.g. minify) back to a previously seen value in server mode. Fixes #14629
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hmaps"
|
||||
"github.com/gohugoio/hugo/resources/resource"
|
||||
|
||||
"github.com/gohugoio/hugo/cache/dynacache"
|
||||
@@ -56,6 +57,8 @@ func newResourceCache(rs *Spec, memCache *dynacache.Cache) *ResourceCache {
|
||||
"/res1/tra",
|
||||
dynacache.OptionsPartition{ClearWhen: dynacache.ClearOnChange, Weight: 40},
|
||||
),
|
||||
|
||||
cacheResourceTransformationPublished: hmaps.NewMap[string, string](),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +71,9 @@ type ResourceCache struct {
|
||||
cacheResources *dynacache.Partition[string, resource.Resources]
|
||||
cacheResourceTransformation *dynacache.Partition[string, *resourceAdapterInner]
|
||||
|
||||
// Used in rebuilds. Maps the target path to the last published transformation key.
|
||||
cacheResourceTransformationPublished *hmaps.Map[string, string]
|
||||
|
||||
fileCache *filecache.Cache
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user