Skip to content

Commit

Permalink
Small tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Forgind committed Aug 28, 2024
1 parent 7075193 commit ac56ea8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ public async Task<string> DownloadPackageAsync(PackageId packageId,

SourceRepository repository = GetSourceRepository(source);

if (isTool && await repository.GetResourceAsync<PackageSearchResourceV3>(cancellationToken).ConfigureAwait(false) is var searchResource)
if (isTool && await repository.GetResourceAsync<PackageSearchResourceV3>(cancellationToken).ConfigureAwait(false) is var searchResource)
{
var results = await searchResource.SearchAsync(packageId.ToString(), new SearchFilter(includePrerelease: includePreview, filter: SearchFilterType.IsLatestVersion)
{
PackageTypes = [NuGet.Packaging.Core.PackageType.DotnetTool.Name]
}, skip: 0, take: 10, log: _verboseLogger, cancellationToken: cancellationToken).ConfigureAwait(false);
if (results.Count() == 0)

if (!results.Any())
{
throw new ToolPackageException(string.Format(LocalizableStrings.NotATool, packageId));
}
Expand Down

0 comments on commit ac56ea8

Please sign in to comment.