Skip to content

Commit c61bd0e

Browse files
committed
Fix Get-File in win32.ps1
1 parent 1f8252a commit c61bd0e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/scripts/win32.ps1

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,19 @@ Function Get-File {
147147
}
148148
break;
149149
} catch {
150-
if ($i -eq ($Retries - 1) -and ($null -ne $FallbackUrl)) {
151-
try {
152-
if($null -ne $OutFile) {
153-
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
154-
} else {
155-
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
150+
if ($i -eq ($Retries - 1)) {
151+
if($FallbackUrl) {
152+
try {
153+
if($null -ne $OutFile) {
154+
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
155+
} else {
156+
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
157+
}
158+
} catch {
159+
throw "Failed to download the assets from $Url and $FallbackUrl"
156160
}
157-
} catch {
158-
throw "Failed to download the assets from $Url and $FallbackUrl"
161+
} else {
162+
throw "Failed to download the assets from $Url"
159163
}
160164
}
161165
}

0 commit comments

Comments
 (0)