Skip to content

Commit

Permalink
exporter: canonicalize sbom file paths during search
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chadwell <[email protected]>
(cherry picked from commit e4c7c6d)
  • Loading branch information
jedevc authored and tonistiigi committed Feb 13, 2023
1 parent a980d83 commit bfe0729
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions exporter/containerimage/attestations.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func newFileLayerFinder(target cache.ImmutableRef, remote *solver.Remote) (fileL
//
// find is not concurrency-safe.
func (c *fileLayerFinder) find(ctx context.Context, s session.Group, filename string) (cache.ImmutableRef, *ocispecs.Descriptor, error) {
filename = filepath.Join("/", filename)

// return immediately if we've already found the layer containing filename
if cache, ok := c.cache[filename]; ok {
return cache.ref, &cache.desc, nil
Expand All @@ -188,6 +190,8 @@ func (c *fileLayerFinder) find(ctx context.Context, s session.Group, filename st

found := false
for _, f := range files {
f = filepath.Join("/", f)

if strings.HasPrefix(f, ".wh.") {
// skip whiteout files, we only care about file creations
continue
Expand Down

0 comments on commit bfe0729

Please sign in to comment.