Fix Get-File in win32.ps1

This commit is contained in:
Shivam Mathur 2023-04-03 00:03:00 +05:30
parent 1f8252a3ed
commit c61bd0e074
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -147,15 +147,19 @@ Function Get-File {
}
break;
} catch {
if ($i -eq ($Retries - 1) -and ($null -ne $FallbackUrl)) {
try {
if($null -ne $OutFile) {
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
} else {
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
if ($i -eq ($Retries - 1)) {
if($FallbackUrl) {
try {
if($null -ne $OutFile) {
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
} else {
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
}
} catch {
throw "Failed to download the assets from $Url and $FallbackUrl"
}
} catch {
throw "Failed to download the assets from $Url and $FallbackUrl"
} else {
throw "Failed to download the assets from $Url"
}
}
}