Fix zipfs.Readdir and zipfs.Readdirnames

If count == 0 all files should be returned as of https://golang.org/pkg/os/#File.Readdir
This commit is contained in:
Jonas Plum 2020-04-14 22:36:17 +02:00 committed by GitHub
parent ceb6a5e372
commit 5fd16ea9f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ func (f *File) Readdir(count int) (fi []os.FileInfo, err error) {
} }
for _, zipfile := range zipfiles { for _, zipfile := range zipfiles {
fi = append(fi, zipfile.FileInfo()) fi = append(fi, zipfile.FileInfo())
if count >= 0 && len(fi) >= count { if count > 0 && len(fi) >= count {
break break
} }
} }
@ -144,7 +144,7 @@ func (f *File) Readdirnames(count int) (names []string, err error) {
} }
for filename := range zipfiles { for filename := range zipfiles {
names = append(names, filename) names = append(names, filename)
if count >= 0 && len(names) >= count { if count > 0 && len(names) >= count {
break break
} }
} }