Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (chocolateyGH-1843) Fix: search exact all versions returns 1
  • Loading branch information
ferventcoder committed Apr 6, 2020
2 parents 9bb4246 + 1f0b866 commit b3a7db5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/chocolatey/infrastructure.app/nuget/NugetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,23 @@ private static IQueryable<IPackage> execute_package_search(ChocolateyConfigurati

if (configuration.ListCommand.Exact)
{
var exactPackage = find_package(searchTermLower, version, configuration, packageRepository);
if (configuration.AllVersions)
{
// convert from a search to getting packages by id.
// search based on lower case id - similar to PackageRepositoryExtensions.FindPackagesByIdCore()
results = packageRepository.GetPackages().Where(x => x.Id.ToLower() == searchTermLower);
}
else
{
var exactPackage = find_package(searchTermLower, version, configuration, packageRepository);

if (exactPackage == null) return new List<IPackage>().AsQueryable();
if (exactPackage == null) return new List<IPackage>().AsQueryable();

return new List<IPackage>()
{
exactPackage
}.AsQueryable();
return new List<IPackage>()
{
exactPackage
}.AsQueryable();
}
}

if (configuration.ListCommand.Page.HasValue)
Expand Down

0 comments on commit b3a7db5

Please sign in to comment.