Skip to content

Commit 4196405

Browse files
committed
utils.pwsh: Add support for curl resume
Note that there is a bug in older versions of curl that can prevent curl from successfully interpreting a fully downloaded file as completed. The bug was fixed on October 30, 2023 and is now available on curl included with Windows. Fixed in curl 8.5.0. curl/curl@225db91
1 parent ccc47dc commit 4196405

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils.pwsh/Invoke-SafeWebRequest.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ function Invoke-SafeWebRequest {
6464
'--output', "$OutFile"
6565
)
6666

67+
$CurlVersionResult = $($(Invoke-External curl --version) -join ' ') -match 'curl (?<CurlVersion>\d+\.\d+\.\d+)'
68+
if ( ( $Matches.CurlVersion -ge '8.5.0' ) -and $Resume ) {
69+
$CurlOptions += @('-C', '-')
70+
}
71+
6772
Invoke-External curl @CurlOptions @HeaderStrings $Uri
6873

6974
$NewHash = Get-FileHash -Path $OutFile -Algorithm $Algorithm

0 commit comments

Comments
 (0)