commit 2b0aef361c4eae4e659f9d5706a47cb492e463d2
parent 8d6f17dc75c22de6c4e4e751804d203924351967
Author: JohnMcPMS <johnmcp@microsoft.com>
Date: Fri, 11 Oct 2024 10:07:00 -0700
Make dependency lookup case insensitive (#4866)
Fixes #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.
Diffstat:
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/AppInstallerCLITests/SQLiteIndex.cpp b/src/AppInstallerCLITests/SQLiteIndex.cpp
@@ -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));
+}
diff --git a/src/AppInstallerRepositoryCore/Microsoft/Schema/1_4/DependenciesTable.cpp b/src/AppInstallerRepositoryCore/Microsoft/Schema/1_4/DependenciesTable.cpp
@@ -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())