mirror of
https://github.com/curl/curl.git
synced 2025-09-23 20:46:48 +03:00
get_url_file_name: make no slash equal empty string
This commit is contained in:
parent
199b3e46f9
commit
b546c7c926
|
@ -140,13 +140,16 @@ CURLcode get_url_file_name(char **filename, const char *url)
|
||||||
pc = url;
|
pc = url;
|
||||||
pc = strrchr(pc, '/');
|
pc = strrchr(pc, '/');
|
||||||
|
|
||||||
if(pc) {
|
if(pc)
|
||||||
/* duplicate the string beyond the slash */
|
/* duplicate the string beyond the slash */
|
||||||
pc++;
|
pc++;
|
||||||
*filename = strdup(pc);
|
else
|
||||||
if(!*filename)
|
/* no slash => empty string */
|
||||||
return CURLE_OUT_OF_MEMORY;
|
pc = "";
|
||||||
}
|
|
||||||
|
*filename = strdup(pc);
|
||||||
|
if(!*filename)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* in case we built debug enabled, we allow an environment variable
|
/* in case we built debug enabled, we allow an environment variable
|
||||||
* named CURL_TESTDIR to prefix the given file name to put it into a
|
* named CURL_TESTDIR to prefix the given file name to put it into a
|
||||||
|
|
Loading…
Reference in New Issue
Block a user