From 5fd16ea9f1c8f259c4826ef78b08f1c1ad62225a Mon Sep 17 00:00:00 2001 From: Jonas Plum Date: Tue, 14 Apr 2020 22:36:17 +0200 Subject: [PATCH] Fix zipfs.Readdir and zipfs.Readdirnames If count == 0 all files should be returned as of https://golang.org/pkg/os/#File.Readdir --- zipfs/file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipfs/file.go b/zipfs/file.go index 6475cdd..57d7201 100644 --- a/zipfs/file.go +++ b/zipfs/file.go @@ -130,7 +130,7 @@ func (f *File) Readdir(count int) (fi []os.FileInfo, err error) { } for _, zipfile := range zipfiles { fi = append(fi, zipfile.FileInfo()) - if count >= 0 && len(fi) >= count { + if count > 0 && len(fi) >= count { break } } @@ -144,7 +144,7 @@ func (f *File) Readdirnames(count int) (names []string, err error) { } for filename := range zipfiles { names = append(names, filename) - if count >= 0 && len(names) >= count { + if count > 0 && len(names) >= count { break } }