diff --git a/syft/source/source.go b/syft/source/source.go index b0cb948e0ff..29cfa461082 100644 --- a/syft/source/source.go +++ b/syft/source/source.go @@ -385,11 +385,11 @@ func (s *Source) SetID() { case FileScheme: // attempt to use the digest of the contents of the file as the ID file, err := os.Open(s.Metadata.Path) - defer file.Close() if err != nil { d = digest.FromString(s.Metadata.Path).String() break } + defer file.Close() di, err := digest.FromReader(file) if err != nil { d = digest.FromString(s.Metadata.Path).String()