diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-02-09 17:58:55 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-02-09 21:35:39 +0100 |
commit | b78576fd38a76bbdaab5ad21228c8e5a559090b1 (patch) | |
tree | db268cb0dcd40dfecffaee5f0d261bc6b6139e70 /hugofs/decorators.go | |
parent | 18888e09bbb5325bdd63f2cd93116ff490dd37ab (diff) |
hugofs: Fix mount with hole regression
Fixes #6854
Diffstat (limited to 'hugofs/decorators.go')
-rw-r--r-- | hugofs/decorators.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/hugofs/decorators.go b/hugofs/decorators.go index e1e3b9b51..123655ba0 100644 --- a/hugofs/decorators.go +++ b/hugofs/decorators.go @@ -81,12 +81,28 @@ func DecorateBasePathFs(base *afero.BasePathFs) afero.Fs { // NewBaseFileDecorator decorates the given Fs to provide the real filename // and an Opener func. func NewBaseFileDecorator(fs afero.Fs) afero.Fs { - ffs := &baseFileDecoratorFs{Fs: fs} decorator := func(fi os.FileInfo, filename string) (os.FileInfo, error) { // Store away the original in case it's a symlink. meta := FileMeta{metaKeyName: fi.Name()} + if fi.IsDir() { + meta[metaKeyJoinStat] = func(name string) (FileMetaInfo, error) { + joinedFilename := filepath.Join(filename, name) + fi, _, err := lstatIfPossible(fs, joinedFilename) + if err != nil { + return nil, err + } + + fi, err = ffs.decorate(fi, joinedFilename) + if err != nil { + return nil, err + } + + return fi.(FileMetaInfo), nil + } + } + isSymlink := isSymlink(fi) if isSymlink { meta[metaKeyOriginalFilename] = filename |