diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-04-14 23:46:51 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-04-15 10:52:33 +0200 |
commit | 54ac447b11e91c2c9db3943cb11281d158dd5e6e (patch) | |
tree | 1aec8841aeeb6d454aaa0883829ac645c08207f7 /src | |
parent | 7ed010ce2192ae3e4d9663eaaa3a460f316b708b (diff) | |
download | curl-54ac447b11e91c2c9db3943cb11281d158dd5e6e.tar.gz |
curl: do NOT append file name to path for upload when there's a query
Added test 425 to verify.
Reported-by: Dirk Rosenkranz
Bug: https://curl.se/mail/archive-2023-04/0008.html
Closes #10969
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operhlp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index f11d65a94..9b70edd23 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -95,6 +95,7 @@ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename) CURLUcode uerr; CURLU *uh = curl_url(); char *path = NULL; + char *query = NULL; if(uh) { char *ptr; uerr = curl_url_set(uh, CURLUPART_URL, *inurlp, @@ -108,7 +109,13 @@ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename) result = urlerr_cvt(uerr); goto fail; } - + uerr = curl_url_get(uh, CURLUPART_QUERY, &query, 0); + if(query) { + curl_free(query); + curl_free(path); + curl_url_cleanup(uh); + return CURLE_OK; + } ptr = strrchr(path, '/'); if(!ptr || !*++ptr) { /* The URL path has no file name part, add the local file name. In order |