Follow links safely during directory discovery

This commit is contained in:
2026-10-19 20:29:20 +00:00
parent f69fa24b40
commit 9b99463187
4 changed files with 602 additions and 24 deletions

View File

@@ -30,21 +30,3 @@ func visitBoundedImportDirectory(access *filesystemAccess, directory string, lim
}
return err
}
func importDirectoryEntryIsDirectory(entry fs.DirEntry) (bool, error) {
mode := entry.Type()
if mode&fs.ModeSymlink != 0 {
return false, nil
}
if mode.IsDir() {
return true, nil
}
if mode != 0 {
return false, nil
}
info, err := entry.Info()
if err != nil {
return false, err
}
return info.IsDir(), nil
}