Skip to content

Commit 3032061

Browse files
committed
Fix zipFiler crash on dirs with subdirs
This happens since nodes for directories don't have their "file" field initialized. Signed-off-by: Tal Einat <[email protected]>
1 parent 63bc934 commit 3032061

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

licensedb/filer/filer.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,13 @@ func (filer *zipFiler) ReadDir(path string) ([]File, error) {
323323
}
324324
result := make([]File, 0, len(node.children))
325325
for name, child := range node.children {
326+
isDir := true
327+
if child.file != nil {
328+
isDir = child.file.FileInfo().IsDir()
329+
}
326330
result = append(result, File{
327331
Name: name,
328-
IsDir: child.file.FileInfo().IsDir(),
332+
IsDir: isDir,
329333
})
330334
}
331335
return result, nil
310 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)