Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Thanks for your feedback.
remopini

Works!
Seems to have no more issues with directories that end in weird characters.
Thank you!
martin

I have sent you a new build.
remopini

WinSCP.SessionRemoteException
HResult=0x80131500
Message=Error listing directory '///projekte/zJobs 2019/159. Gerber Fondue (Gifs)/3. Produktion/04. Castings/01. Darsteller/Casting BETH UK Hero '.
Could not retrieve directory listing
/projekte/zJobs 2019/159. Gerber Fondue (Gifs)/3. Produktion/04. Castings/01. Darsteller/Casting BETH UK Hero: No such file or directory
Source=WinSCPnet
StackTrace:
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.Session.ListDirectory(String path)
at ChocSync.MainWindow.GetDirectory(BackgroundWorker worker, String ftppath, ITree`1 tree, INode`1 node, Session ftpsession, Int32 level)
remopini

Great thx!
Got a new error now:
directory = ftpsession.ListDirectory(ftppath)
throws an error if ftppath ends with a space. The space seems to get removed automatically and the result is an Exception:
Error listing directory ... : No such file or directory

ftppath was just extracted from a previous RemoteFileInfo from a .ListDirectory collection.

It seems that ListDirectory removes trailing spaces before running the actual command?
martin

Thanks for your feedback. I've sent you the assembly.
remopini

Great!
Works as a standalone app with that directory now.
Any chance you can send me an updated .net assembly so I can test it programmatically? It won't accept the new WinSCP because of a version mismatch.
martin

Thanks for the logs.

This issue has been added to the tracker:
https://winscp.net/tracker/1900

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.
remopini

logs
remopini

The folder in question is:
(Filezilla) Status: Directory listing of "/projekte/zJobs 2019/159. Gerber Fondue (Gifs)/3. Produktion/04. Castings/01. Darsteller/Casting BETH UK Hero " successful

Note the extra space (or tab or whatever it is) at the end of the directory name.
martin

Re: Trailing Spaces in Directory Names

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
remopini

Trailing Spaces in Directory Names

Hi all

Since this works in Filezilla but not in WinSCP, I assume it is a bug:

I have a NAS (QNAP) with an FTP server on it. Since the NAS is used by OSX machines, users tend to put all different kinds of crap in their filenames (which I hate, but it is what it is...).

I'm using the .NET component to write my own sync script (to get various files from the FTP server and save them locally on a regular basis).

This works fine unless either the filename or a directory name has one or more trailing whitespaces. The problem is (it seems), that Session.ListDirectory(path) fails if the path ends in whitespaces. Also any returned RemoteFileInfo items seem to be stripped of trailing whitespaces, too, even though in FileZilla listings, they are clearly there.