Skip to content

Commit e6c4929

Browse files
Merge pull request #267 from chocolatey/fixV3ClientSetup
(#266) Updates Version Lookup in ClientSetup Script
2 parents e07804a + 9fb4aab commit e6c4929

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

scripts/ClientSetup.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,12 @@ if ($Credential) {
8484

8585
# Find the latest version of Chocolatey, if a version was not specified
8686
$NupkgUrl = if (-not $ChocolateyVersion) {
87-
$QueryString = "((Id eq 'chocolatey') and (not IsPrerelease)) and IsLatestVersion"
88-
$Query = 'Packages()?$filter={0}' -f [uri]::EscapeUriString($queryString)
89-
$QueryUrl = ($RepositoryUrl.TrimEnd('/index.json'), $Query) -join '/'
90-
91-
[xml]$result = $webClient.DownloadString($QueryUrl)
92-
$result.feed.entry.content.src
87+
$QueryUrl = ($RepositoryUrl.TrimEnd('/index.json'), "v3/registration/Chocolatey/index.json") -join '/'
88+
$Result = $webClient.DownloadString($QueryUrl) | ConvertFrom-Json
89+
$Result.items.items[-1].packageContent
9390
} else {
9491
# Otherwise, assume the URL
95-
"$($RepositoryUrl.TrimEnd('/index.json'))/chocolatey/$($ChocolateyVersion)"
92+
"$($RepositoryUrl.TrimEnd('/index.json'))/v3/content/chocolatey/$($ChocolateyVersion)/chocolatey.$($ChocolateyVersion).nupkg"
9693
}
9794

9895
# Download the NUPKG

0 commit comments

Comments
 (0)