Add sanity check to the file walker

As more tests now hit the virtual filesystem, add this check
to prevent any walking of the entire file system.
This commit is contained in:
Bjørn Erik Pedersen 2016-07-30 19:54:07 +02:00
parent 802d43cbfd
commit 94d998989d

View file

@ -467,6 +467,11 @@ func FindCWD() (string, error) {
// the file structure
func SymbolicWalk(fs afero.Fs, root string, walker filepath.WalkFunc) error {
// Sanity check
if len(root) < 5 {
return fmt.Errorf("Path to short, cannot walk the root: %s", root)
}
// Handle the root first
fileInfo, err := lstatIfOs(fs, root)