miyako/4d-plugin-curl-v3

Error 3 with Mac and space in URL

FabienArr opened this issue · 6 comments

Hi Keisuke,

With the last release of cURL 4.4.12, we discover a bug when the URL contains spaces.
In download or upload, if the URL contain a space we got error 3. It's occur only on mac not on windows.
If you need more explanations i'm open.

Regards

the space is URL encoded?

I don't think so :

//Test upload
$Turl:="sftp://home173627097.1and1-data.host/"
C_OBJET($Oftp)
OB FIXER($Oftp;
"URL"; $Turl;
"USERNAME"; "u1688469212";
"PASSWORD"; "azertyuiop12345;";
"USE_SSL"; "1";
"FTP_SSL_CCC"; "CCC_ACTIVE")
$Tfichier:="C:\Users\Fabien\Documents\Points 220713104236.txt"
$Oftp.READDATA:=$Tfichier
$Oftp.URL:=$Turl+"Points 220713104236.txt" //Here the space in URL

$Lerreur:=qCu0_LFtpTransfert($Oftp)

the plugin doesn't escape the URL for you.

see source code: https://github.com/miyako/4d-plugin-curl-v3/blob/main/curl/4DPlugin-cURL.cpp#L1235

curl_easy_setopt(curl, CURLOPT_URL, url.c_str());

the string you pass is given directly to cURL.

that is why there is a command to escape.

Ok thanks, but why it occurs only on Mac and not on Windows ?
Because since the version 4.2.1, we didn't escape and it worked nice

I don't understand how work your cURL_Escape command.
If i escape my entire URL like this :
$1.URL:="sftp://home173627097.1and1-data.host/Points_220713104236.txt"
$1.URL:=cURL_Escape($1.URL)
I get this : sftp%253A%252F%252Fhome173627097.1and1-data.host%252FPoints_220713104236.txt
So why not, but the file is not uploaded

In the callback i get this : http://sftp%3A%2F%2Fhome173627097.1and1-data.host%2FPoints_220713104236.txt/
So i understand why it doesn't work, because cURL add http://.
What i missed ? i need to split all the URL on the / for not escape only this character ?

Thanks