Skip to content
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

GetListing problem with a pathname containing whitespaces and a server only supporting LIST #755

Closed
JosHuybrighs opened this issue Sep 1, 2021 · 2 comments

Comments

@JosHuybrighs
Copy link

FTP OS: Windows

FTP Server: CompleteFTP

Computer OS: Windows 10

FluentFTP Version: 35.0.2

I am using FluentFTP as a client in the next update of my SyncFolder sync/backup app (available in Windows Store). When testing with various type of FTP servers I am getting an error with the CompleteFTP Manager server when using GetListing with a path that contains whitespaces, like: "/Home/user/My Music". The server returns no items and the log says: "550 Directory does not exist."
I tested with the command line ftp client in windows and found the following:

ls /Home/user/My Music gives error 550
ls "/Home/user/My Music" is OK

I tried various ways to overcome this, like:

GetListing($"\"{path}\""),
GetListing(path.Replace(' ', '+')),
etc.

None of those were successfull, so I think that something is missing here. I have seen the topic coming up in other issue discussions, but also there I didn't find anything pointing to a solution.

I could overcome this by first setting the working directory to the path of which I would get the list and then using GetListing with the NoPath option, like so:

if (!_workingDirectory.Equals(path))
{
    _ftpClient.SetWorkingDirectory(path);
    _workingDirectory = path;
}
var items = _ftpClient.GetListing(null, FtpListOption.AllFiles | FtpListOption.NoPath);

This successfully returns all files and folders in "/Home/user/My Music".

There still is however a small error: all returned items have a wrong FullName property. E.g. if there is a file music.mp3 then the FullName property is set to "/music.mp3" instead of "/Home/user/My Music/music.mp3". This I can solve myself in my code but might be an issue for others.

@robinrodricks
Copy link
Owner

robinrodricks commented Sep 1, 2021 via email

@robinrodricks
Copy link
Owner

Added to the bucket list. We will pick this up as and when we have free time. Comment on this issue if you want us to prioritize it. Thanks!

@robinrodricks robinrodricks closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants