mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
resources: Use different cache key when copying resources
Closes #10412 Closes #12310
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
38e05bd3c7
commit
54a8f0ce21
@@ -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),
|
||||
|
Reference in New Issue
Block a user