Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(azcopy) Fix script to handle URL redirection in PowerShell Core #2600

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions automatic/azcopy10/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

$releases = 'https://aka.ms/downloadazcopy-v10-windows'

function global:au_GetLatest {
$url64 = Get-RedirectedUrl -Url $releases
$url32 = $url64 -replace "amd64", "386"
$version = $url64 -replace ".zip", "" -split "_" | Select-Object -Last 1

@{
URL32 = $url32
URL64 = $url64
Version = $version
}
}

function global:au_SearchReplace {
@{
".\tools\chocolateyInstall.ps1" = @{
Expand All @@ -15,18 +27,4 @@ function global:au_SearchReplace {
}
}

function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases -MaximumRedirection 0 -ErrorAction SilentlyContinue

$url64 = $download_page.Headers.Location
$url32 = $url64 -replace "amd64", "386"
$version = $url64 -replace ".zip", "" -split "_" | Select-Object -Last 1

@{
URL32 = $url32
URL64 = $url64
Version = $version
}
}

update -ChecksumFor all