]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: better error message when -O fails to get a good name
authorDaniel Stenberg <daniel@haxx.se>
Thu, 26 Aug 2021 05:43:34 +0000 (07:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 26 Aug 2021 08:41:15 +0000 (10:41 +0200)
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

src/tool_operate.c

index 74221599db759ac2d76762318188ef1a61dcf201..960f3020a037d4e2f52a6757e71bc4cb5479e636 100644 (file)
@@ -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;