FTPListOutput silently fails when FileName contains full or relative path

Giganews Newsgroups
Subject: FTPListOutput silently fails when FileName contains full or relative path
Posted by:  TJ Nannon (in…@cheddar.mailworks.org)
Date: Mon, 10 Jan 2005

When the client issues the commands:
cd /
nlist /Foo

the server should respond with the following file list on the data channel:
/Foo/File_A.txt

The best I can get the Indy FTPListOutput class to do is to respond with just "File_A.txt", which is not correct, at least compared to the BSD ftp server.

When the FileName property of the FTPListOutputItem contains a full path (or a slash or backslash in it anywhere), the resulting output is an empty string: "", no newline or anything.

The following code (C#) demonstrates the problem with Indy 10.0.51.

I expect the output "/Foo/File_A.txt\r\
", but I get "".

FTPListOutput ftpListOutput = new FTPListOutput();
ftpListOutput.DirFormat = DirOutputFormat.doUnix;

FTPListOutputItem ftpItem = ftpListOutput.Add();
ftpItem.ItemType = DirItemType.ditFile;
ftpItem.FileName = "/Foo/File_A.txt";

IndyStrings dirContentsStringList = new IndyStringList();
ftpListOutput.NLISTOutputDir( dirContentsStringList );

string result = dirContentsStringList.Text;

/////////////////////////

Thanks.

Replies