Validate filesystem in addInputFS
This commit is contained in:
parent
ed40673e85
commit
b55ae961c8
@ -74,11 +74,17 @@ func (m *manifest) addInputPath(inputPath string) error {
|
||||
}
|
||||
|
||||
func (m *manifest) addInputFS(f afero.Fs) error {
|
||||
if f == nil {
|
||||
return errors.New("filesystem cannot be nil")
|
||||
}
|
||||
// Validate filesystem is accessible by statting root
|
||||
if _, err := f.Stat("/"); err != nil {
|
||||
return fmt.Errorf("filesystem not accessible: %w", err)
|
||||
}
|
||||
if m.sourceFS == nil {
|
||||
m.sourceFS = make([]afero.Fs, 0)
|
||||
}
|
||||
m.sourceFS = append(m.sourceFS, f)
|
||||
// FIXME do some sort of check on f here?
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user