File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -116,13 +116,17 @@ function Save-WebFile {
116
116
else {
117
117
Write-Verbose " cURL Source: $SourceUrl "
118
118
Write-Verbose " Destination: $DestinationFullName "
119
-
120
- if ($host.name -match ' ConsoleHost' ) {
121
- Invoke-Expression " & curl.exe --insecure --location --output `" $DestinationFullName `" --url `" $SourceUrl `" "
122
- }
123
- else {
124
- # PowerShell ISE will display a NativeCommandError, so progress will not be displayed
125
- $Quiet = Invoke-Expression " & curl.exe --insecure --location --output `" $DestinationFullName `" --url `" $SourceUrl `" 2>&1"
119
+ $Headers = Invoke-Expression " & curl.exe --head --silent --insecure --location --url `" $SourceUrl `" "
120
+ if ($Headers [0 ] -match " 200.+OK" ) {
121
+ if ($host.name -match ' ConsoleHost' ) {
122
+ Invoke-Expression " & curl.exe --insecure --location --output `" $DestinationFullName `" --url `" $SourceUrl `" "
123
+ }
124
+ else {
125
+ # PowerShell ISE will display a NativeCommandError, so progress will not be displayed
126
+ $Quiet = Invoke-Expression " & curl.exe --insecure --location --output `" $DestinationFullName `" --url `" $SourceUrl `" 2>&1"
127
+ }
128
+ } else {
129
+ Write-Warning " Header status: $ ( $headers [0 ]) "
126
130
}
127
131
}
128
132
# =================================================
You can’t perform that action at this time.
0 commit comments