fix:handle compound aliases like ``.tgz`` when cataloging archives (#4421)

---------
Signed-off-by: Yuntao Hu <victorhu493@gmail.com>
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Co-authored-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
VictorHuu
2025-12-02 16:55:32 -05:00
committed by GitHub
co-authored by Christopher Phillips
parent d37ed567a8
commit afe28a2fc0
9 changed files with 138 additions and 13 deletions
+2 -3
View File
@@ -6,9 +6,8 @@ import (
"strings"
"time"
"github.com/mholt/archives"
"github.com/anchore/packageurl-go"
"github.com/anchore/syft/internal/file"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom"
@@ -155,7 +154,7 @@ func trimRelative(s string) string {
// isArchive returns true if the path appears to be an archive
func isArchive(path string) bool {
format, _, err := archives.Identify(context.Background(), path, nil)
format, _, err := file.IdentifyArchive(context.Background(), path, nil)
return err == nil && format != nil
}