New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

This comment has been minimized.

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.

@jzakrzewski

This comment has been minimized.

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

This comment has been minimized.

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

@bagder

This comment has been minimized.

Member

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

@bagder

This comment has been minimized.

Member

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

This comment has been minimized.

Zenju commented Oct 10, 2017

It seems CURLOPT_CUSTOMREQUEST "MLSD" is needed to reproduce

@bagder

This comment has been minimized.

Member

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

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

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