mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
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:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user