Skip to content

Commit

Permalink
[Bug] Remove clean-up of img after ScanContainer is called. Clean…
Browse files Browse the repository at this point in the history
…-up should be done by the caller of the function.

PiperOrigin-RevId: 715374365
  • Loading branch information
Mario Leyva authored and copybara-github committed Jan 14, 2025
1 parent 9491c94 commit 966644c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions artifact/image/layerscanning/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ func fillChainLayerWithFilesFromTar(img *Image, tarReader *tar.Reader, originLay

// realFilePath is where the file will be written to disk. filepath.Clean first to convert
// to OS specific file path.
// TODO: b/377553499 - Escape invalid characters on windows that's valid on linux
// realFilePath := filepath.Join(dirPath, filepath.Clean(cleanedFilePath))
realFilePath := filepath.Join(dirPath, filepath.FromSlash(cleanedFilePath))

var newNode *fileNode
Expand Down
2 changes: 0 additions & 2 deletions scalibr.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ func (Scanner) Scan(ctx context.Context, config *ScanConfig) (sr *ScanResult) {
// details. Functions to create an Image from a tarball, remote name, or v1.Image are available in
// the artifact/image/layerscanning/image package.
func (s Scanner) ScanContainer(ctx context.Context, img *image.Image, config *ScanConfig) (sr *ScanResult, err error) {
defer img.CleanUp()

chainLayers, err := img.ChainLayers()
if err != nil {
return nil, fmt.Errorf("failed to get chain layers: %w", err)
Expand Down

0 comments on commit 966644c

Please sign in to comment.