File tree Expand file tree Collapse file tree 2 files changed +28
-20
lines changed
Expand file tree Collapse file tree 2 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -31,29 +31,33 @@ Function Get-File {
3131 param (
3232 [string ]$Url ,
3333 [string ]$FallbackUrl ,
34- [string ]$OutFile ,
34+ [string ]$OutFile = ' ' ,
3535 [int ]$Retries = 3 ,
3636 [int ]$TimeoutSec = 0
3737 )
3838
3939 for ($i = 0 ; $i -lt $Retries ; $i ++ ) {
4040 try {
41- if ($null -ne $OutFile ) {
41+ if ($OutFile -ne ' ' ) {
4242 Invoke-WebRequest - Uri $Url - OutFile $OutFile - TimeoutSec $TimeoutSec
4343 } else {
4444 Invoke-WebRequest - Uri $Url - TimeoutSec $TimeoutSec
4545 }
4646 break ;
4747 } catch {
48- if ($i -eq ($Retries - 1 ) -and ($null -ne $FallbackUrl )) {
49- try {
50- if ($null -ne $OutFile ) {
51- Invoke-WebRequest - Uri $FallbackUrl - OutFile $OutFile - TimeoutSec $TimeoutSec
52- } else {
53- Invoke-WebRequest - Uri $FallbackUrl - TimeoutSec $TimeoutSec
48+ if ($i -eq ($Retries - 1 )) {
49+ if ($FallbackUrl ) {
50+ try {
51+ if ($OutFile -ne ' ' ) {
52+ Invoke-WebRequest - Uri $FallbackUrl - OutFile $OutFile - TimeoutSec $TimeoutSec
53+ } else {
54+ Invoke-WebRequest - Uri $FallbackUrl - TimeoutSec $TimeoutSec
55+ }
56+ } catch {
57+ throw " Failed to download the assets from $Url and $FallbackUrl "
5458 }
55- } catch {
56- throw " Failed to download the build "
59+ } else {
60+ throw " Failed to download the assets from $Url "
5761 }
5862 }
5963 }
Original file line number Diff line number Diff line change @@ -31,29 +31,33 @@ Function Get-File {
3131 param (
3232 [string ]$Url ,
3333 [string ]$FallbackUrl ,
34- [string ]$OutFile ,
34+ [string ]$OutFile = ' ' ,
3535 [int ]$Retries = 3 ,
3636 [int ]$TimeoutSec = 0
3737 )
3838
3939 for ($i = 0 ; $i -lt $Retries ; $i ++ ) {
4040 try {
41- if ($null -ne $OutFile ) {
41+ if ($OutFile -ne ' ' ) {
4242 Invoke-WebRequest - Uri $Url - OutFile $OutFile - TimeoutSec $TimeoutSec
4343 } else {
4444 Invoke-WebRequest - Uri $Url - TimeoutSec $TimeoutSec
4545 }
4646 break ;
4747 } catch {
48- if ($i -eq ($Retries - 1 ) -and ($null -ne $FallbackUrl )) {
49- try {
50- if ($null -ne $OutFile ) {
51- Invoke-WebRequest - Uri $FallbackUrl - OutFile $OutFile - TimeoutSec $TimeoutSec
52- } else {
53- Invoke-WebRequest - Uri $FallbackUrl - TimeoutSec $TimeoutSec
48+ if ($i -eq ($Retries - 1 )) {
49+ if ($FallbackUrl ) {
50+ try {
51+ if ($OutFile -ne ' ' ) {
52+ Invoke-WebRequest - Uri $FallbackUrl - OutFile $OutFile - TimeoutSec $TimeoutSec
53+ } else {
54+ Invoke-WebRequest - Uri $FallbackUrl - TimeoutSec $TimeoutSec
55+ }
56+ } catch {
57+ throw " Failed to download the assets from $Url and $FallbackUrl "
5458 }
55- } catch {
56- throw " Failed to download the build "
59+ } else {
60+ throw " Failed to download the assets from $Url "
5761 }
5862 }
5963 }
You can’t perform that action at this time.
0 commit comments