Skip to content

Commit

Permalink
Fix unpacking sboms issue from older Zarf packages (#1621)
Browse files Browse the repository at this point in the history
## Description

This fixes an issue where SBOMs from older packages are not unpacked
correctly.

## Related Issue

Fixes #1610

## Type of change

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
Racer159 committed Apr 19, 2023
1 parent 5666ae2 commit d5624a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pkg/packager/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ func (p *Packager) Inspect(includeSBOM bool, outputSBOM string, inspectPublicKey

if includeSBOM || outputSBOM != "" {
// Extract the SBOM files from the sboms.tar file
if err := archiver.Unarchive(p.tmp.SbomTar, p.tmp.Sboms); err != nil {
return fmt.Errorf("unable to extract the SBOM files: %w", err)
_, tarErr := os.Stat(p.tmp.SbomTar)
if tarErr == nil {
if err := archiver.Unarchive(p.tmp.SbomTar, p.tmp.Sboms); err != nil {
return fmt.Errorf("unable to extract the SBOM files: %w", err)
}
}

}

// Open a browser to view the SBOM if specified
Expand Down

0 comments on commit d5624a6

Please sign in to comment.