Skip to content

Commit

Permalink
Update fs.go
Browse files Browse the repository at this point in the history
Updating per suggestion, looks great!

Co-authored-by: Matt Holt <[email protected]>
  • Loading branch information
drewstinnett and mholt authored Aug 30, 2023
1 parent 369af42 commit b3db794
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,14 @@ func (f ArchiveFS) ReadDir(name string) ([]fs.DirEntry, error) {
)
handler := func(_ context.Context, file File) error {
file.NameInArchive = strings.Trim(file.NameInArchive, "/")
if file.NameInArchive != "." {
files = append(files, file)
if file.NameInArchive == name && !file.IsDir() {
foundFile = true
return errStopWalk
}
if file.NameInArchive == "." {
return nil
}
files = append(files, file)
if file.NameInArchive == name && !file.IsDir() {
foundFile = true
return errStopWalk
}
}
return nil
}
Expand Down

0 comments on commit b3db794

Please sign in to comment.