fix: return error instead of panicking on an unreadable directory during copy (#6020)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
TowyTowyandClaude Fable 5 authored and GitHub committed 2026-07-18 07:21:44 +02:00
1 parent f0785391bf
commit ac46cf0671
2 files changed
+55 -1

No files matched your search

+6 -1
View File
@@ -23,7 +23,12 @@ func CopyDir(afs afero.Fs, source, dest string, fileMode, dirMode fs.FileMode) e
return err
}
dir, _ := afs.Open(source)
dir, err := afs.Open(source)
if err != nil {
return err
}
defer dir.Close()
obs, err := dir.Readdir(-1)
if err != nil {
return err