Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/release-notes/1.31/2558-productcode-case-insensitive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Bug Fixes

### ProductCode matching is case-insensitive for single-package searches

Single-package searches now send ProductCode matches as case-insensitive requests, allowing REST sources to match ProductCode values whose casing differs from the installed ARP value or manifest value.
5 changes: 3 additions & 2 deletions src/AppInstallerCLICore/Workflows/WorkflowBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,10 @@ namespace AppInstaller::CLI::Workflow
{
std::string_view query = args.GetArg(Execution::Args::Type::Query);

// Regardless of match type, always use an exact match for the system reference strings.
// Package family names use folded exact matching in the local index. Product codes
// must be case-insensitive for REST sources, which may preserve manifest casing.
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::PackageFamilyName, MatchType::Exact, query));
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::ProductCode, MatchType::Exact, query));
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::ProductCode, MatchType::CaseInsensitive, query));
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::Id, matchType, query));
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::Name, matchType, query));
searchRequest.Inclusions.emplace_back(PackageMatchFilter(PackageMatchField::Moniker, matchType, query));
Expand Down
19 changes: 19 additions & 0 deletions src/AppInstallerCLITests/SourceFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,25 @@ TEST_CASE("Search_ManifestResolution_BeforeSourcePriority", "[RestSource][Source
REQUIRE(lookups == 1);
}

TEST_CASE("SearchRequestForSingle_ProductCodeIsCaseInsensitive", "[workflow]")
{
std::ostringstream output;
TestContext context{ output, std::cin };
auto previousThreadGlobals = context.SetForCurrentThread();
context.Args.AddArg(Execution::Args::Type::Query, "Fiddler2"sv);

context << GetSearchRequestForSingle;

const auto& searchRequest = context.Get<Execution::Data::SearchRequest>();
auto productCode = std::find_if(searchRequest.Inclusions.begin(), searchRequest.Inclusions.end(), [](const auto& filter)
{
return filter.Field == PackageMatchField::ProductCode;
});
REQUIRE(productCode != searchRequest.Inclusions.end());
REQUIRE(productCode->Value == "Fiddler2");
REQUIRE(productCode->Type == MatchType::CaseInsensitive);
}

TEST_CASE("SourcePriority_SourceOutput", "[SourcePriority][workflow]")
{
GroupPolicyTestOverride policies;
Expand Down
Loading