Always record uploaded pkg files as "apps" source if they have a bundle ID to avoid conflicts with the same package appearing in inventory later (#26374)

For #26373.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [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] A detailed QA plan exists on the associated ticket (if it isn't
there, work with the product group's QA engineer to add it)
- [x] Manual QA for all new/changed functionality

Autoated tests cover the code in the changes.
This commit is contained in:
Ian Littman
2025-02-24 16:38:57 -06:00
committed by GitHub
parent a14fd0d263
commit f5ca50a340
2 changed files with 9 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
* Fixed a bug where uploading a macOS installer could prevent the software from being inventoried.
+8 -4
View File
@@ -1409,11 +1409,15 @@ func (svc *Service) addMetadataToSoftwarePayload(ctx context.Context, payload *f
payload.UninstallScript = file.GetUninstallScript(meta.Extension)
}
source, err := fleet.SofwareInstallerSourceFromExtensionAndName(meta.Extension, meta.Name)
if err != nil {
return "", ctxerr.Wrap(ctx, err, "determining source from extension and name")
if payload.BundleIdentifier != "" {
payload.Source = "apps"
} else {
source, err := fleet.SofwareInstallerSourceFromExtensionAndName(meta.Extension, meta.Name)
if err != nil {
return "", ctxerr.Wrap(ctx, err, "determining source from extension and name")
}
payload.Source = source
}
payload.Source = source
platform, err := fleet.SofwareInstallerPlatformFromExtension(meta.Extension)
if err != nil {