mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05: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:
parent
802d43cbfd
commit
94d998989d
1 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue