Skip to main content

Posts

Featured

Downloading with correct filename with cURL and Wget

Sometimes, some websites would have links like: https://example.com/get?file_id=123 https://example.com/get/foobar-1.0.tar.gz?blah=mlah The first one probably is a redirection to an actual location with a clear filename in URL, and/or serving the content with Content-Disposition header to tell the client what the filename is.  The second one is just to annoy me. However, they cause issue with Wget and cURL (with -O ) as it would save them as: get?file_id=123 foobar-1.0.tar.gz?blah=mlah That is not that what we want for the downloaded files, both only use the URL you provide to decide the filename for the saved file. In web browser, such links will be handled properly as long as the responding headers are set correctly, the save dialog would give you the correct filenames. Both cURL and Wget can handle the cases, but the solutions don't come without warnings, be sure to read wget(1) and curl(1) before implementing the solutions mentioned below. Wget I love usi

Latest Posts

Disabling Blinking Cursor in GTK+

Turning off Full Screen toolbar in LibreOffice Writer

Moving Google Analytics Accounts to Another Google Account

Conditional Formatting the Entire Row based on a Column in Google Sheets

The First Bit