mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 246 forks source link

Cannot download folders and/or filenames containing space #145

Open igabesz opened 8 years ago

igabesz commented 8 years ago

Got an SFTP access where there is a path like /stufff/others/some directory/ containing a file with space in its name: some file. First I CWD to some directory which works, however, downloadingsome file fails.

I have my workaround: Backslashing all spaces in the names, i.e. some\ direcory and some\ file. However, a nice solution for this would come handy.

Fun fact: this problem did not appear when I ran the program under Windows and the backslashing neither causes any harm. I guess Windows' ftp command handles spaces better...

igabesz commented 8 years ago

This hopefully solves #131 too

igabesz commented 8 years ago

Some further info: https://www.howtoforge.com/community/threads/how-to-rename-or-use-mv-command-with-filenames-with-spaces.23063/ http://www.perlmonks.org/?node_id=182444

igabesz commented 8 years ago

Ok, something is really fishy here.

Sometimes I manage to download a file through SFTP from a directory containing a space plus the filename also contains a space. Sometimes it works with backslash-spaces but mostly not -- on Linux. Usually I have no problem on Windows. This seems to be some hazardous stuff: once I get it working, a couple of minutes later it fails using the exactly same program with the exactly same input. The SFTP is not under our maintenace, we don't have write access, so I cannot say anything more about it.

Strange it is, that neither the internal sftp command of Linux sees any files with spaces in their names under a directory containing a space (I can cd to it though). Or at least usually it does not see those files, maybe sometimes it does, I don't know.

So my best advice so far: Don't ever use filenames and directory names containing spaces through FTP!