FluentFTP: GetListing does not handle spaces in filenames as expected - use machine listings as default
FTP OS: Unix
FTP Server: Pure-FTPd
Computer OS: ? Windows 10
FluentFTP Version: ? Various 34.0.1, 34.0.0, 30.0.0
Create the following file structure.
file-4 is a chroot for a virtual user. Debian Buster: pure-ftpd/stable,now 1.0.47-3 amd64 [installed]
/file-4
/file-4/previews & style/crossdomain.xml
/file-4/previews/20150(408163454.jpg
/file-4/previews/20150408163454.jpg
/file-4/previews/20160313923123.jpg
/file-4/perviews/crossdomain.xml
DeleteDirectory() of /file-4 fails with 550:Could not delete /file-4/previews & style/20150(408163454.jpg: No such file or directory
FtpClient.GetListing(StoragePath + “/previews & style/”, FtpListOption.ForceList | FtpListOption.Recursive); Running the above command produces a listing wit 4 files in it.
"/file-4/previews & style/20150(408163454.jpg"
"/file-4/previews & style/20150408163454.jpg"
"/file-4/previews & style/20160313923123.jpg"
"/file-4/previews & style/crossdomain.xml"
FtpClient.GetListing(StoragePath + “/preview”, FtpListOption.ForceList | FtpListOption.Recursive); No Results
FtpClient.GetListing(StoragePath + “/previews”, FtpListOption.ForceList | FtpListOption.Recursive);
"/file-4/previews/20150(408163454.jpg"
"/file-4/previews/20150408163454.jpg"
"/file-4/previews/20160313923123.jpg"
"/file-4/previews/crossdomain.xml"
FtpClient.GetListing(StoragePath + “/previews any text i like”, FtpListOption.ForceList | FtpListOption.Recursive);
"/file-4/previews any text i like/20150(408163454.jpg"
"/file-4/previews any text i like/20150408163454.jpg"
"/file-4/previews any text i like/20160313923123.jpg"
"/file-4/previews any text i like/crossdomain.xml"
Logs :
# GetWorkingDirectory()
# Connect()
Status: Connecting to ***:21
Response: 220-XXX server.
Response: 220-Unauthorised access is not permitted.
Response: 220 This is a private system - No anonymous login
Command: AUTH TLS
Response: 234 AUTH TLS OK.
Status: FTPS Authentication Successful
Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.0999281.
Command: USER ***
Response: 331 User *** OK. Password required
Command: PASS ***
Response: 230 OK. Current directory is /
Command: PBSZ 0
Response: 200 PBSZ=0
Command: PROT P
Response: 200 Data protection level set to "private"
Command: FEAT
Response: 211-Extensions supported:
Response: EPRT
Response: IDLE
Response: MDTM
Response: SIZE
Response: MFMT
Response: REST STREAM
Response: MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
Response: MLSD
Response: AUTH TLS
Response: PBSZ
Response: PROT
Response: UTF8
Response: TVFS
Response: ESTA
Response: PASV
Response: EPSV
Response: SPSV
Response: 211 End.
Status: Text encoding: System.Text.UTF8Encoding
Command: OPTS UTF8 ON
Response: 200 OK, UTF-8 enabled
Command: SYST
Response: 215 UNIX Type: L8
Command: PWD
Response: 257 "/" is your current location
# GetListing("/file-4/previews any text i like/", ForceList)
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
# OpenPassiveDataStream(AutoPassive, "LIST /file-4/previews any text i like", 0)
Command: EPSV
Response: 229 Extended Passive mode OK (|||2690|)
Status: Connecting to ***:2690
Command: LIST /file-4/previews any text i like
Response: 150 Accepted data connection
Status: FTPS Authentication Successful
Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.0069988.
+---------------------------------------+
Listing: /file-4/previews:
Listing: -rw-r--r-- 1 1001 ftp 2581 Jul 19 10:58 20150(408163454.jpg
Listing: -rw-r--r-- 1 1001 ftp 2581 Jul 19 10:58 20150408163454.jpg
Listing: -rw-r--r-- 1 1001 ftp 2581 Jul 19 10:58 20160313923123.jpg
Listing: -rw-r--r-- 1 1001 ftp 2581 Jul 19 10:58 crossdomain.xml
-----------------------------------------
Status: Disposing FtpSocketStream...
# CloseDataStream()
Response: 226-Options: -l
Response: 226 4 matches total
Status: Disposing FtpSocketStream...
Status: Not in UNIX format
Status: Not in UNIX format
Status: Not in Windows format
Status: Not in OS/400 format
Status: Not in VMS format
Status: Could not detect format. Using default Unix
Warning: Failed to parse file listing: /file-4/previews:
Status: Confirmed format Unix
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
Commits related to this issue
- #739 and #745 - improve machine listing handling and name list detection — committed to robinrodricks/FluentFTP by robinrodricks 3 years ago
Sorry for never getting back to you. We recently did an upgrade to latest FluentFTP and our tests which cover this pass. So definitely all good.
Rereading this issue now, I don’t even know how I managed that analysis but I’m glad it helped.
MLSD supports spaces in the name, which is why it works as expected.
Running the Delete on 34.0.1.
The key difference I can see here is that we don’t use recursive, so when “LIST /preview a” is submitted, you get the wrong answer.
I’m surprised with all the recursive and alternative listing commands that it’s defaulting to the non-recursive version.
Listing on 19.1.2, is also broken, as you indicated.
However the delete method behaved in a different way on 19.1.2 and did not fail. It gets it correct, because the folder that it’s initially deleting does not have a space, so it correctly lists the subfolders. 34.0.1 could not do that. I’ll post that in a minute.
Doing the delete on 19.1.2