Validate filesystem in addInputFS

This commit is contained in:
Jeffrey Paul 2025-12-17 17:05:42 -08:00
parent ed40673e85
commit b55ae961c8

View File

@ -74,11 +74,17 @@ func (m *manifest) addInputPath(inputPath string) error {
} }
func (m *manifest) addInputFS(f afero.Fs) 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 { if m.sourceFS == nil {
m.sourceFS = make([]afero.Fs, 0) m.sourceFS = make([]afero.Fs, 0)
} }
m.sourceFS = append(m.sourceFS, f) m.sourceFS = append(m.sourceFS, f)
// FIXME do some sort of check on f here?
return nil return nil
} }