summaryrefslogtreecommitdiffhomepage
path: root/resources/image.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-09-03 10:36:09 +0200
committerBjørn Erik Pedersen <[email protected]>2019-09-03 18:38:57 +0200
commit8624b9fe9eb81aeb884d36311fb6f85fed98aa43 (patch)
tree830fcb271584065cc6577c17808ade64cdb68b88 /resources/image.go
parent018494f363a32b9e4d3622da6842bc3e59b420b2 (diff)
downloadhugo-8624b9fe9eb81aeb884d36311fb6f85fed98aa43.tar.gz
hugo-8624b9fe9eb81aeb884d36311fb6f85fed98aa43.zip
Cache processed images by their source path
Fixes #6269
Diffstat (limited to 'resources/image.go')
-rw-r--r--resources/image.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/resources/image.go b/resources/image.go
index 8242f7119..8a9e6fde4 100644
--- a/resources/image.go
+++ b/resources/image.go
@@ -24,6 +24,7 @@ import (
"io/ioutil"
"os"
"path"
+ "path/filepath"
"strings"
"sync"
@@ -319,10 +320,13 @@ func (i *imageResource) getImageMetaCacheTargetPath() string {
cfg := i.getSpec().imaging.Cfg
df := i.getResourcePaths().relTargetDirFile
+ if fi := i.getFileInfo(); fi != nil {
+ df.dir = filepath.Dir(fi.Meta().Path())
+ }
p1, _ := helpers.FileAndExt(df.file)
h, _ := i.hash()
idStr := internal.HashString(h, i.size(), imageMetaVersionNumber, cfg)
- return path.Join(df.dir, fmt.Sprintf("%s%s.json", p1, idStr))
+ return path.Join(df.dir, fmt.Sprintf("%s_%s.json", p1, idStr))
}
func (i *imageResource) relTargetPathFromConfig(conf images.ImageConfig) dirFile {