FTP: CURLFTPMETHOD_NOCWD does not URL-decode the path #1974

Closed
Zenju opened this Issue Oct 9, 2017 · 7 comments

Comments

Projects
None yet
3 participants

Zenju commented Oct 9, 2017

I did this

An FTP transfer with CURLFTPMETHOD_NOCWD selected.

A URL with one or more URL encoded "letters".

I expected the following

The path to be URL decoded by curl before use.

curl/libcurl version

any

operating system

any

Zenju commented Oct 9, 2017

I'm basically having the same issue as in #1812
When CURLFTPMETHOD_NOCWD is used and the URL contains a hash, e.g. "/dir/#name", then the rest including the hash is stripped, resulting in a file not found error because lstArg is "/dir/" from the code example in the other ticket.

Contributor

jzakrzewski commented Oct 9, 2017

Then you should have read @bagder 's comment on the issue: #1812 (comment)
Since "#" has special meaning in the URL, it must be URL-encoded when used outside it's meaning.

@bagder bagder added FTP URL labels Oct 9, 2017

Zenju commented Oct 9, 2017

Okay, let's see what happens when we urlencode the string...

lstArg becomes /dir/%23name, still file not found, ups...

Remember, Curl does not urldecode the string in the CURLFTPMETHOD_NOCWD case

Owner

bagder commented Oct 9, 2017

That is a bug.

@bagder bagder changed the title from FTP: CURLFTPMETHOD_NOCWD + # not working 2 to FTP: CURLFTPMETHOD_NOCWD does not URL-decode the path Oct 9, 2017

bagder added a commit that referenced this issue Oct 9, 2017

Owner

bagder commented Oct 9, 2017

I can't reproduce. So I edited test 298 to use an URL encoded path with nocwd (see commit above) and it works just fine.

Zenju commented Oct 10, 2017

It seems CURLOPT_CUSTOMREQUEST "MLSD" is needed to reproduce

Owner

bagder commented Oct 10, 2017

Not quite. But it seems a directory listing is needed!

bagder added a commit that referenced this issue Oct 10, 2017

FTP: URL decode path for dir listing in nocwd mode
Reported-by: Zenju on github

Test 244 added to verify
Fixes #1974

@bagder bagder closed this in ecf21c5 Oct 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment