cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl gives files from sourceforge strange names

From: Dave Reisner <d_at_falconindy.com>
Date: Fri, 4 Dec 2015 14:26:23 -0500

On Fri, Dec 04, 2015 at 02:07:45PM -0500, David Niklas wrote:
> Hello,
> curl -O -C - -L
> http://sourceforge.net/projects/absolute-linux/files/Absolute_14.12/absolute-14.12.iso/download?use_mirror=heanet
>
> Gives the files weird names, this prevents resuming, due to the
> difference in file names (hint: notice the ts value?):
> absolute-14.12.iso?r=http%3A%2F%2Fsourceforge.net%2Fsettings%2Fmirror_choices%3Fprojectname%3Dabsolute-linux%26filename%3DAbsolute_14.12%2Fabsolute-14.12.iso&ts=1449255232&use_mirror=heanet
>
> absolute-14.12.iso?r=http%3A%2F%2Fsourceforge.net%2Fsettings%2Fmirror_choices%3Fprojectname%3Dabsolute-linux%26filename%3DAbsolute_14.12%2Fabsolute-14.12.iso&ts=1449255624&use_mirror=heanet
>
> To resolve this, I use -o absolute-14.12.iso, but I think that curl
> could figure this out, since the file name is in the url.
> But curl is yours, so what do you think is the correct behaviour?

Behavior seems correct for -O. Passing -J in addition gives you the name
from the content-disposition header at the end of the redirect chain:

  content-disposition: attachment; filename="absolute-14.12.iso"

As a result, you get the name you want.

Cheers,
dR
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-12-04