Skip to content

Commit

Permalink
Make dependency lookup case insensitive (microsoft#4866)
Browse files Browse the repository at this point in the history
Fixes microsoft#3679 

## Change
Makes the dependency lookup case insensitive.

## Validation
Adds a new test that exercises adding a package with a dependency that
does not match the case of the original package identifier.
  • Loading branch information
JohnMcPMS authored Oct 11, 2024
1 parent 8d6f17d commit 2b0aef3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/AppInstallerCLITests/SQLiteIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3835,3 +3835,24 @@ TEST_CASE("SQLiteIndex_V2_0_UsageFlow_ComplexMigration", "[sqliteindex][V2_0]")

MigratePrepareAndCheckIntermediates(baseFile, preparedFile, { { manifest2 }, { manifest1, manifest3, manifest4 } });
}

TEST_CASE("SQLiteIndex_DependencyWithCaseMismatch", "[sqliteindex][V1_4]")
{
TempFile tempFile{ "repolibtest_tempdb"s, ".db"s };
INFO("Using temporary file named: " << tempFile.GetPath());

Manifest dependencyManifest1, dependencyManifest2, manifest;
SQLiteIndex index = SimpleTestSetup(tempFile, dependencyManifest1, SQLiteVersion::Latest());

// Must contain some upper case
auto& publisher2 = "Test2";
CreateFakeManifest(dependencyManifest2, publisher2);
index.AddManifest(dependencyManifest2, GetPathFromManifest(dependencyManifest2));

auto& publisher3 = "Test3";
CreateFakeManifest(manifest, publisher3);
manifest.Installers[0].Dependencies.Add(Dependency(DependencyType::Package, dependencyManifest1.Id, "1.0.0"));
manifest.Installers[0].Dependencies.Add(Dependency(DependencyType::Package, ToLower(dependencyManifest2.Id), "1.0.0"));

index.AddManifest(manifest, GetPathFromManifest(manifest));
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace AppInstaller::Repository::Microsoft::Schema::V1_4
{
installer.Dependencies.ApplyToType(dependencyType, [&](Manifest::Dependency dependency)
{
auto packageRowId = IdTable::SelectIdByValue(connection, dependency.Id());
auto packageRowId = IdTable::SelectIdByValue(connection, dependency.Id(), true);
std::optional<Utility::NormalizedString> version;

if (!packageRowId.has_value())
Expand Down

0 comments on commit 2b0aef3

Please sign in to comment.