Skip to content

Commit

Permalink
Fix msstore repair mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed Feb 18, 2024
1 parent 0679c9b commit 0c277a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ namespace AppInstaller::CLI::Workflow
{
context.Reporter.Info() << Resource::String::InstallFlowInstallSuccess << std::endl;
}

}
}

Expand Down
16 changes: 15 additions & 1 deletion src/AppInstallerCLICore/Workflows/RepairFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,23 @@ namespace AppInstaller::CLI::Workflow
AICLI_TERMINATE_CONTEXT(APPINSTALLER_CLI_ERROR_NO_APPLICABLE_INSTALLER);
}

std::string_view requestedVersion = context.Args.Contains(Execution::Args::Type::Version) ? context.Args.GetArg(Execution::Args::Type::Version) : installedVersion.ToString();
// If it's Store source with only one version unknown, use the unknown version for available version mapping.
const auto& package = context.Get<Execution::Data::Package>();
auto versionKeys = package->GetAvailableVersionKeys();
if (versionKeys.size() == 1)
{
auto packageVersion = package->GetAvailableVersion(versionKeys.at(0));
if (packageVersion->GetSource().IsWellKnownSource(WellKnownSource::MicrosoftStore) &&
Utility::Version{ packageVersion->GetProperty(PackageVersionProperty::Version) }.IsUnknown())
{
requestedVersion = "";
}
}

context <<
GetManifestWithVersionFromPackage(
context.Args.Contains(Execution::Args::Type::Version) ? context.Args.GetArg(Execution::Args::Type::Version) : installedVersion.ToString(),
requestedVersion,
context.Args.GetArg(Execution::Args::Type::Channel), false) <<
SelectInstaller <<
EnsureApplicableInstaller;
Expand Down

0 comments on commit 0c277a3

Please sign in to comment.