Skip to content

Commit 08d5b7a

Browse files
authored
Fix 1688 "Find-PSResource -Name * does not return anything on 1.0.5+" (#1706)
1 parent e83ff8d commit 08d5b7a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/code/V2ServerAPICalls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM
901901
} else {
902902
filterBuilder.AddCriterion("IsLatestVersion");
903903
}
904-
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?$filter={queryBuilder.BuildQueryString()}";
904+
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?{queryBuilder.BuildQueryString()}";
905905
return HttpRequestCall(requestUrlV2, out errRecord);
906906
}
907907

test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $modPath = "$psscriptroot/../PSGetTestUtils.psm1"
55
Import-Module $modPath -Force -Verbose
66

77
$psmodulePaths = $env:PSModulePath -split ';'
8-
Write-Verbose -Verbose "Current module search paths: $psmodulePaths"
8+
Write-Verbose -Verbose -Message "Current module search paths: $psmodulePaths"
99

1010
Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' {
1111

@@ -56,6 +56,11 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'CI' {
5656
$foundScript | Should -BeTrue
5757
}
5858

59+
It "find all resources when wildcard only for Name" {
60+
$res = Find-PSResource -Name '*' -Repository $PSGalleryName
61+
$res.Count | Should -BeGreaterThan 0
62+
}
63+
5964
$testCases2 = @{Version="[5.0.0.0]"; ExpectedVersions=@("5.0.0.0"); Reason="validate version, exact match"},
6065
@{Version="5.0.0.0"; ExpectedVersions=@("5.0.0.0"); Reason="validate version, exact match without bracket syntax"},
6166
@{Version="[1.0.0.0, 5.0.0.0]"; ExpectedVersions=@("1.0.0.0", "3.0.0.0", "5.0.0.0"); Reason="validate version, exact range inclusive"},

0 commit comments

Comments
 (0)