-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filename too long - Warning: Failed to create the file #2174
Comments
I'm not for this. If you are not sure that the server will provide the filename and you have a query like that I would use --output instead |
I agree with @jay. If possible, the error message could be clearer. |
The error message shown above was shortemed, wasn't it? The code already uses strerror() which should at least include some clue about the specific reason for the failure. I would presume the errno would be |
Shortened? Not really, full output:
error code = 23 I'm using curl as a download tool for custom webkit-based browser (surf). Option -J is necessary to have proper filenames for downloadable *zip, *pdf, etc. On the other hand I could trim filename by myself (in surf c code), but in such case I loose -J Content-Disposition filename because -o is apparently superior to -J. So other expected solution would be:
but to make -o "my-filename" work only if Content-Disposition is not in the headers. |
Aaah, the warning message itself is truncated as it only uses a 256 bytes buffer so the error message after the file name isn't visible! I'll start out by fixing that... (commit 5d0ba70)
Yes, -J only works with -O. I suppose it could be expanded to also work with So really, with a >255 bytes long part to the right of the rightmost slash, |
I think curl is doing the right thing here. It tries to use the name as instructed, and when it fails is tells the user why. With the landed fix, it should now display it even with very long file names in the message. |
I did this
curl -O -J
"http://example.com/test?somelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelon
gargumentlistsomelongargumentlistsomelongargumentlistsomelongarg"
and got
Warning: Failed to create the file
and than
curl: (23) Failed writing body (0 != 1270)
I expected the following
File
"test?somelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelongargumentlistsomelon
gargumentlistsomelongargumentlistsomelongargumentlistsomelongarg"
will be created in current directory but it's not the case because filename is > 255 bytes.
If curl cannot create file because name is too long than I expect file with trimmed name to be created.
curl/libcurl version
curl 7.56.1 (x86_64-pc-linux-gnu) libcurl/7.56.1
operating system
4.13.12-1-ARCH x86_64 GNU/Linux
Filesystem: ext4
The text was updated successfully, but these errors were encountered: