Scripted downloads succeed, but are empty zero-byte files

Rate this Article
No votes yet

Most of our raw package downloads (.exe, .dmg, .zip, and so on) allow scripting using a latest keyword instead of a literal version number, which allows scripts to dynamically fetch the current production version of each component at runtime. Each component that allows this functionality displays a "scripted downloads" section, including curl commands that you can copy and paste into your scripts (or execute on the command line).

Due to recent changes in our CDN infrastructure, the curl flags used to invoke this behavior must be updated. Previously, the commands simply required the -O flag. These commands will now technically succeed (they do not throw an error), but will download an empty (zero-byte) file. This issue is caused by a new internal redirect system, which the CDN uses to return the correct file; by default, curl will not follow this redirect, resulting in an apparently successful but empty download. To fix this, we now add flags to ensure the redirect is followed and the download works as expected.

Our website now displays the correct command for each package, and new scripts can use them without modification. 

For existing scripts, add -1Lf to your curl commands, as shown next:

Old:

curl -O '{url}'  # Results in an empty file download

New:

curl -1Lf -O '{url}'