summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-08-26 07:43:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-08-26 10:41:15 +0200
commite8e656c845c9b1fe4480ecc02aedb2110fb8dd59 (patch)
treecd0410004d07a358edb4ad4f002132ea69974f39
parent1a042be2703bc14037399ea21e23c69b0808c764 (diff)
downloadcurl-e8e656c845c9b1fe4480ecc02aedb2110fb8dd59.tar.gz
curl: better error message when -O fails to get a good name
Due to how this currently works internally, it needs a working initial file name to store contents in, so it may still fail even with -J is used (and thus accepting a name from content-disposition:) if the file name part of the URL isn't "good enough". Fixes #7628 Closes #7635
-rw-r--r--src/tool_operate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 74221599d..960f3020a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -950,8 +950,11 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(!per->outfile) {
/* extract the file name from the URL */
result = get_url_file_name(&per->outfile, per->this_url);
- if(result)
+ if(result) {
+ errorf(global, "Failed to extract a sensible file name"
+ " from the URL to use for storage!\n");
break;
+ }
if(!*per->outfile && !config->content_disposition) {
errorf(global, "Remote file name has no length!\n");
result = CURLE_WRITE_ERROR;