Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
fix: avoid copying empty paths
Browse files Browse the repository at this point in the history
  • Loading branch information
b4nst committed Mar 17, 2022
1 parent b0a95aa commit 61cff11
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ func New() *Context {
// GetFS returns the standard fs.FS underlying filesystem.
// The returned filesystem is read only.
func (c *Context) GetFS() iofs.FS {
return afero.NewIOFS(afero.NewReadOnlyFs(c.fs))
return afero.NewIOFS(c.GetAferoFS())
}

// GetAferoFS returns the uderlying afero.Fs of this context.
func (c *Context) GetAferoFS() afero.Fs {
return afero.NewReadOnlyFs(c.fs)
}

// Add copies the content of fs into this Context.
Expand All @@ -35,6 +40,9 @@ func Copy(dst, src afero.Fs) error {
if err != nil {
return err
}
if path == "" {
return nil
}

switch info.Mode() {
case iofs.ModeDir:
Expand Down

0 comments on commit 61cff11

Please sign in to comment.