Skip to content

Commit

Permalink
core: fix downloader duplicating downloads
Browse files Browse the repository at this point in the history
Signed-off-by: Abiola Ibrahim <git@abiosoft.com>

The downloader currently has undesired behaviour of downloading twice
when fetching the possible redirect URL of the asset to be downloaded.

This resolves it by ensuring the initial request is an HEAD request.
  • Loading branch information
abiosoft committed Aug 6, 2024
1 parent 5321c10 commit 07a77d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/downloader/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (d downloader) downloadFile(r Request) (err error) {
}

// get rid of curl's initial progress bar by getting the redirect url directly.
downloadURL, err := d.host.RunOutput("curl", "-Ls", "-o", "/dev/null", "-w", "%{url_effective}", r.URL)
downloadURL, err := d.host.RunOutput("curl", "-ILs", "-o", "/dev/null", "-w", "%{url_effective}", r.URL)
if err != nil {
return fmt.Errorf("error retrieving redirect url: %w", err)
}
Expand Down

0 comments on commit 07a77d0

Please sign in to comment.