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.

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

- [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
This commit is contained in:
Jahziel Villasana-Espinoza
2025-03-28 15:56:29 -04:00
committed by GitHub
parent 4cc896a63e
commit 01a5db696d
5 changed files with 12 additions and 5 deletions
@@ -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 {
+2 -1
View File
@@ -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
}
@@ -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
}
@@ -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",
@@ -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",