duplicate reference readers for duplicate location resolutions

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2021-01-05 13:54:39 -05:00
parent bb70b0b43e
commit fc8b431ea6
10 changed files with 53 additions and 33 deletions
+3 -3
View File
@@ -22,18 +22,18 @@ func NewLocation(path string) Location {
}
// NewLocationFromImage creates a new Location representing the given path (extracted from the ref) relative to the given image.
func NewLocationFromImage(ref file.Reference, img *image.Image) Location {
func NewLocationFromImage(path string, ref file.Reference, img *image.Image) Location {
entry, err := img.FileCatalog.Get(ref)
if err != nil {
log.Warnf("unable to find file catalog entry for ref=%+v", ref)
return Location{
Path: string(ref.RealPath),
Path: path,
ref: ref,
}
}
return Location{
Path: string(ref.RealPath),
Path: path,
FileSystemID: entry.Layer.Metadata.Digest,
ref: ref,
}