Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hugofs/decorators.go')
-rw-r--r--hugofs/decorators.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/hugofs/decorators.go b/hugofs/decorators.go
index 123655ba0..6247f6183 100644
--- a/hugofs/decorators.go
+++ b/hugofs/decorators.go
@@ -80,7 +80,8 @@ 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 {
+func NewBaseFileDecorator(fs afero.Fs, callbacks ...func(fi FileMetaInfo)) afero.Fs {
+
ffs := &baseFileDecoratorFs{Fs: fs}
decorator := func(fi os.FileInfo, filename string) (os.FileInfo, error) {
@@ -120,7 +121,14 @@ func NewBaseFileDecorator(fs afero.Fs) afero.Fs {
return ffs.open(filename)
}
- return decorateFileInfo(fi, ffs, opener, filename, "", meta), nil
+ fim := decorateFileInfo(fi, ffs, opener, filename, "", meta)
+
+ for _, cb := range callbacks {
+ cb(fim)
+ }
+
+ return fim, nil
+
}
ffs.decorate = decorator