Rework the Destination filesystem to make --renderStaticToDisk work

See #9626
This commit is contained in:
Bjørn Erik Pedersen
2022-03-21 09:35:15 +01:00
parent b08193971a
commit d070bdf10f
75 changed files with 651 additions and 566 deletions

View File

@@ -22,7 +22,10 @@ import (
"github.com/spf13/afero"
)
var _ afero.Fs = (*md5HashingFs)(nil)
var (
_ afero.Fs = (*md5HashingFs)(nil)
_ FilesystemUnwrapper = (*md5HashingFs)(nil)
)
// FileHashReceiver will receive the filename an the content's MD5 sum on file close.
type FileHashReceiver interface {
@@ -45,6 +48,10 @@ func NewHashingFs(delegate afero.Fs, hashReceiver FileHashReceiver) afero.Fs {
return &md5HashingFs{Fs: delegate, hashReceiver: hashReceiver}
}
func (fs *md5HashingFs) UnwrapFilesystem() afero.Fs {
return fs.Fs
}
func (fs *md5HashingFs) Create(name string) (afero.File, error) {
f, err := fs.Fs.Create(name)
if err == nil {