aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/resource_factories
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-03-25 14:17:57 -0700
committerBjørn Erik Pedersen <[email protected]>2024-03-27 09:59:59 +0100
commit54a8f0ce21015df7f9927dca358b6d09a560e37b (patch)
treeb0e642432936d2c0a3b0a6b2de171814275655ca /resources/resource_factories
parent38e05bd3c7afdd676ac924222c66579978846b84 (diff)
downloadhugo-54a8f0ce21015df7f9927dca358b6d09a560e37b.tar.gz
hugo-54a8f0ce21015df7f9927dca358b6d09a560e37b.zip
resources: Use different cache key when copying resources
Closes #10412 Closes #12310
Diffstat (limited to 'resources/resource_factories')
-rw-r--r--resources/resource_factories/create/create.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go
index 061ecf1e7..4725cf390 100644
--- a/resources/resource_factories/create/create.go
+++ b/resources/resource_factories/create/create.go
@@ -57,7 +57,7 @@ func New(rs *resources.Spec) *Client {
// Copy copies r to the new targetPath.
func (c *Client) Copy(r resource.Resource, targetPath string) (resource.Resource, error) {
- key := dynacache.CleanKey(targetPath)
+ key := dynacache.CleanKey(targetPath) + "__copy"
return c.rs.ResourceCache.GetOrCreate(key, func() (resource.Resource, error) {
return resources.Copy(r, targetPath), nil
})
@@ -66,7 +66,7 @@ func (c *Client) Copy(r resource.Resource, targetPath string) (resource.Resource
// Get creates a new Resource by opening the given pathname in the assets filesystem.
func (c *Client) Get(pathname string) (resource.Resource, error) {
pathname = path.Clean(pathname)
- key := dynacache.CleanKey(pathname)
+ key := dynacache.CleanKey(pathname) + "__get"
return c.rs.ResourceCache.GetOrCreate(key, func() (resource.Resource, error) {
// The resource file will not be read before it gets used (e.g. in .Content),