diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-15 11:01:14 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2020-09-21 13:53:18 +0300 |
commit | 483cafe9ebe19811621e8eb95a7712ceb85c9bab (patch) | |
tree | 3a858c6cc8f35043cd8a5ff651fd3d149f08f986 /internal/vfs/zip/archive.go | |
parent | 130c178d7475ab4d592b0953b3f6ab5829804911 (diff) |
WIP: apply some of the suggestions
Diffstat (limited to 'internal/vfs/zip/archive.go')
-rw-r--r-- | internal/vfs/zip/archive.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go index 1d64e148..c2c331b1 100644 --- a/internal/vfs/zip/archive.go +++ b/internal/vfs/zip/archive.go @@ -82,17 +82,19 @@ func (a *zipArchive) readArchive(ctx context.Context) { a.archive, a.err = zip.NewReader(a.reader, a.resource.Size) }) - if a.archive != nil { - for _, file := range a.archive.File { - if !strings.HasPrefix(file.Name, dirPrefix) { - continue - } - a.files[file.Name] = file - } + if a.archive == nil { + return + } - // recycle memory - a.archive.File = nil + for _, file := range a.archive.File { + if !strings.HasPrefix(file.Name, dirPrefix) { + continue + } + a.files[file.Name] = file } + + // recycle memory + a.archive.File = nil } func (a *zipArchive) findFile(name string) *zip.File { |