mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 10:36:45 +01:00
fix: guard for locations < 1 in alpmdb parse (#1366)
This commit is contained in:
parent
b290a445ca
commit
0cbd0cc703
@ -42,10 +42,12 @@ func parseAlpmDB(resolver source.FileResolver, env *generic.Environment, reader
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgFiles, err := parseMtree(r)
|
pkgFiles, err := parseMtree(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// The replace the files found the the pacman database with the files from the mtree These contain more metadata and
|
// The replace the files found the the pacman database with the files from the mtree These contain more metadata and
|
||||||
// thus more useful.
|
// thus more useful.
|
||||||
metadata.Files = pkgFiles
|
metadata.Files = pkgFiles
|
||||||
@ -106,6 +108,10 @@ func getFileReader(path string, resolver source.FileResolver) (io.Reader, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(locs) == 0 {
|
||||||
|
return nil, fmt.Errorf("could not find file: %s", path)
|
||||||
|
}
|
||||||
// TODO: Should we maybe check if we found the file
|
// TODO: Should we maybe check if we found the file
|
||||||
dbContentReader, err := resolver.FileContentsByLocation(locs[0])
|
dbContentReader, err := resolver.FileContentsByLocation(locs[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user