use filepath.Base() instead of path.Base() for temp files (#882)

This commit is contained in:
Oscar Hallgren
2022-04-01 10:42:22 -04:00
committed by GitHub
parent f24bbc1838
commit 1aeda6bb50
@@ -5,14 +5,13 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
) )
func saveArchiveToTmp(archiveVirtualPath string, reader io.Reader) (string, string, func(), error) { func saveArchiveToTmp(archiveVirtualPath string, reader io.Reader) (string, string, func(), error) {
name := path.Base(archiveVirtualPath) name := filepath.Base(archiveVirtualPath)
tempDir, err := ioutil.TempDir("", "syft-archive-contents-") tempDir, err := ioutil.TempDir("", "syft-archive-contents-")
if err != nil { if err != nil {
return "", "", func() {}, fmt.Errorf("unable to create tempdir for archive processing: %w", err) return "", "", func() {}, fmt.Errorf("unable to create tempdir for archive processing: %w", err)