From 01a5db696db240eaef264e2d7679d14a0fe43153 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana-Espinoza Date: Fri, 28 Mar 2025 15:56:29 -0400 Subject: [PATCH] add a field for fuzzy matching name in existence query (#27648) > For #27633 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [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 --- ee/maintained-apps/ingesters/winget/ingester.go | 7 ++++++- ee/maintained-apps/inputs/winget/notion.json | 3 ++- ee/maintained-apps/inputs/winget/postman.json | 3 ++- ee/maintained-apps/outputs/notion/windows.json | 2 +- ee/maintained-apps/outputs/postman/windows.json | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ee/maintained-apps/ingesters/winget/ingester.go b/ee/maintained-apps/ingesters/winget/ingester.go index a5a4e81215..1fcffe7a8b 100644 --- a/ee/maintained-apps/ingesters/winget/ingester.go +++ b/ee/maintained-apps/ingesters/winget/ingester.go @@ -275,8 +275,12 @@ func (i *wingetIngester) ingestOne(ctx context.Context, input inputApp) (*mainta if input.UniqueIdentifier != "" { name = input.UniqueIdentifier } + existsTemplate := "SELECT 1 FROM programs WHERE name = '%s' AND publisher = '%s';" + if input.FuzzyMatchName { + existsTemplate = "SELECT 1 FROM programs WHERE name LIKE '%s %%' AND publisher = '%s';" + } out.Queries = maintained_apps.FMAQueries{ - Exists: fmt.Sprintf("SELECT 1 FROM programs WHERE name = '%s' AND publisher = '%s';", name, publisher), + Exists: fmt.Sprintf(existsTemplate, name, publisher), } out.InstallScript = installScript out.UninstallScript = preProcessUninstallScript(uninstallScript, productCode) @@ -331,6 +335,7 @@ type inputApp struct { InstallerScope string `json:"installer_scope"` ProgramPublisher string `json:"program_publisher"` UninstallType string `json:"uninstall_type"` + FuzzyMatchName bool `json:"fuzzy_match_name"` } type installerManifest struct { diff --git a/ee/maintained-apps/inputs/winget/notion.json b/ee/maintained-apps/inputs/winget/notion.json index 7293621caf..5ede30829d 100644 --- a/ee/maintained-apps/inputs/winget/notion.json +++ b/ee/maintained-apps/inputs/winget/notion.json @@ -7,5 +7,6 @@ "uninstall_script_path": "ee/maintained-apps/inputs/winget/scripts/notion_uninstall.ps1", "installer_arch": "x64", "installer_type": "exe", - "installer_scope": "user" + "installer_scope": "user", + "fuzzy_match_name": true } diff --git a/ee/maintained-apps/inputs/winget/postman.json b/ee/maintained-apps/inputs/winget/postman.json index 017ca80e49..6b09086f89 100644 --- a/ee/maintained-apps/inputs/winget/postman.json +++ b/ee/maintained-apps/inputs/winget/postman.json @@ -7,5 +7,6 @@ "uninstall_script_path": "ee/maintained-apps/inputs/winget/scripts/postman_uninstall.ps1", "installer_arch": "x64", "installer_type": "exe", - "installer_scope": "user" + "installer_scope": "user", + "fuzzy_match_name": true } diff --git a/ee/maintained-apps/outputs/notion/windows.json b/ee/maintained-apps/outputs/notion/windows.json index 87ea057906..75889957e5 100644 --- a/ee/maintained-apps/outputs/notion/windows.json +++ b/ee/maintained-apps/outputs/notion/windows.json @@ -3,7 +3,7 @@ { "version": "4.7.1", "queries": { - "exists": "SELECT 1 FROM programs WHERE name = 'Notion' AND publisher = 'Notion Labs, Inc';" + "exists": "SELECT 1 FROM programs WHERE name LIKE 'Notion %' AND publisher = 'Notion Labs, Inc';" }, "installer_url": "https://desktop-release.notion-static.com/Notion%20Setup%204.7.1.exe", "install_script_ref": "8bc5996b", diff --git a/ee/maintained-apps/outputs/postman/windows.json b/ee/maintained-apps/outputs/postman/windows.json index 1e59170104..e56c09b864 100644 --- a/ee/maintained-apps/outputs/postman/windows.json +++ b/ee/maintained-apps/outputs/postman/windows.json @@ -3,7 +3,7 @@ { "version": "11.38.5", "queries": { - "exists": "SELECT 1 FROM programs WHERE name = 'Postman' AND publisher = 'Postman';" + "exists": "SELECT 1 FROM programs WHERE name LIKE 'Postman %' AND publisher = 'Postman';" }, "installer_url": "https://dl.pstmn.io/download/version/11.38.5/windows_64", "install_script_ref": "9bdf51d7",