From 3263f1105fd5efd14f69c73d625e110ebbb8f6a7 Mon Sep 17 00:00:00 2001 From: Weston Steimel Date: Wed, 31 Jan 2024 14:26:15 +0000 Subject: [PATCH] fix(dotnet): improve forming dotnet package names Signed-off-by: Weston Steimel --- .../pkg/cataloger/dotnet/parse_dotnet_portable_executable.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syft/pkg/cataloger/dotnet/parse_dotnet_portable_executable.go b/syft/pkg/cataloger/dotnet/parse_dotnet_portable_executable.go index 2228d11d15f..98327e0565a 100644 --- a/syft/pkg/cataloger/dotnet/parse_dotnet_portable_executable.go +++ b/syft/pkg/cataloger/dotnet/parse_dotnet_portable_executable.go @@ -175,7 +175,7 @@ var ( func findName(versionResources map[string]string) string { // PE files found in the wild _not_ authored by Microsoft seem to use ProductName as a clear // identifier of the software - nameFields := []string{"ProductName", "FileDescription", "InternalName", "OriginalFilename"} + nameFields := []string{"InternalName", "OriginalFilename", "ProductName", "FileDescription"} if isMicrosoft(versionResources) { // Microsoft seems to be consistent using the FileDescription, with a few that are blank and have @@ -188,6 +188,9 @@ func findName(versionResources map[string]string) string { if value == "" { continue } + + value = strings.TrimSuffix(strings.ReplaceAll(value, " ", "."), ".dll") + return value }