From 5a30b477c65fe1ab274697ee3cd655db221ba24a Mon Sep 17 00:00:00 2001 From: Ian Littman Date: Tue, 31 Dec 2024 14:28:15 -0600 Subject: [PATCH] Fall back to FileVersion when an EXE installer has FileVersion but not ProductVersion (#25070) For #23541 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [x] Manual QA for all new/changed functionality --- changes/23541-fileversion-fallback | 1 + pkg/file/pe.go | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changes/23541-fileversion-fallback diff --git a/changes/23541-fileversion-fallback b/changes/23541-fileversion-fallback new file mode 100644 index 0000000000..b9ec9f22ad --- /dev/null +++ b/changes/23541-fileversion-fallback @@ -0,0 +1 @@ +* Added fallback to FileVersion on EXE installers when FileVersion is set but ProductVersion isn't to allow more custom packages to be uploaded diff --git a/pkg/file/pe.go b/pkg/file/pe.go index 4516b5a25e..0f5f7eb61c 100644 --- a/pkg/file/pe.go +++ b/pkg/file/pe.go @@ -72,6 +72,8 @@ func ExtractPEMetadata(tfr *fleet.TempFileReader) (*InstallerMetadata, error) { } if productVersion != "" { version = productVersion + } else if strings.TrimSpace(e["FileVersion"]) != "" { + version = strings.TrimSpace(e["FileVersion"]) } } if name == "" && sfxName != "" {