Cache processed images by their source path

Fixes #6269
This commit is contained in:
Bjørn Erik Pedersen
2019-09-03 10:36:09 +02:00
parent 018494f363
commit 8624b9fe9e
9 changed files with 127 additions and 33 deletions

View File

@@ -22,6 +22,8 @@ import (
"path/filepath"
"sync"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/media"
"github.com/gohugoio/hugo/source"
@@ -172,6 +174,7 @@ type fileInfo interface {
getSourceFilename() string
setSourceFilename(string)
setSourceFs(afero.Fs)
getFileInfo() hugofs.FileMetaInfo
hash() (string, error)
size() int
}
@@ -537,7 +540,7 @@ type resourceFileInfo struct {
// the path to the file on the real filesystem.
sourceFilename string
fi os.FileInfo
fi hugofs.FileMetaInfo
// A hash of the source content. Is only calculated in caching situations.
h *resourceHash
@@ -555,6 +558,10 @@ func (fi *resourceFileInfo) ReadSeekCloser() (hugio.ReadSeekCloser, error) {
return f, nil
}
func (fi *resourceFileInfo) getFileInfo() hugofs.FileMetaInfo {
return fi.fi
}
func (fi *resourceFileInfo) getSourceFilename() string {
return fi.sourceFilename
}