[FTPFileSystem] Path argument for TFTPFileSystem::DoChangeDirectory is Filename instead of Directory
Error observed in WinSCP versions 575 and 576
Protocol Type: FTP
Server Type: AVM Fritz!Box Router Models (7170, 7050, 7360, 7490) all updated
Operation: Scripted
File is present and can be transferred using the GUI
Operation section:
Normal behavior:
Session log snippet:
Background information
WinSCP seems to fetch remote file information any time a file is being downloaded
-> This leads to remote directory listing on certain servers
If a script knows that a file is present, would it be possible to disable file information retrieval by configurable boolean property?
-> This could help to reduce amount of transactions for managed remote file systems
-> This would also be a hotfix for the problem I encountered
After brief survey of the source, it seems that
Relevant Function:
Hopefully this information can be of some use, WinSCP really is a great software and thanks to the scripting interface it achieves an utmost degree of versatility.
Finally I'd be really thankful if it were possible to implement the property switch spoken of in order to improve efficiency in an automated usage scenario.
With kind regards, Williams4411
On Model 7050
Protocol Type: FTP
Server Type: AVM Fritz!Box Router Models (7170, 7050, 7360, 7490) all updated
Operation: Scripted
getFiles(/Intenso-AluLine-01/folder/file.json)
File is present and can be transferred using the GUI
Operation section:
STAT
command
Normal behavior:
STAT
command, GET
command
Session log snippet:
Script: stat -- "/Intenso-AluLine-01/folder/file.json"
Listing file "/Intenso-AluLine-01/folder/file.json".
Retrieving file information...
PWD
257 "/Intenso-AluLine-01/folder" is current directory.
CWD /Intenso-AluLine-01/folder/file.json
550 /Intenso-AluLine-01/folder/file.json: Not a directory.
TYPE I
200 Type set to I.
SIZE /Intenso-AluLine-01/folder/file.json
213 508
MDTM /Intenso-AluLine-01/folder/file.json
550 /Intenso-AluLine-01/folder/file.json: No such file or directory
Could not retrieve file information
Script: Can't get attributes of file '/Intenso-AluLine-01/folder/file.json'.
Script: Could not retrieve file information
/Intenso-AluLine-01/folder/file.json: No such file or directory
Script: Failed
WinSCP seems to fetch remote file information any time a file is being downloaded
-> This leads to remote directory listing on certain servers
If a script knows that a file is present, would it be possible to disable file information retrieval by configurable boolean property?
-> This could help to reduce amount of transactions for managed remote file systems
-> This would also be a hotfix for the problem I encountered
After brief survey of the source, it seems that
DoChangeDirectory
is called with the filename as argument instead of the file's directory.
Relevant Function:
void __fastcall TFTPFileSystem::ChangeDirectory(const UnicodeString ADirectory) { UnicodeString Directory = ADirectory; try { // For changing directory, we do not make paths absolute, instead we // delegate this to the server, hence we synchronize current working // directory with the server and only then we ask for the change with // relative path. // But if synchronization fails, typically because current working directory // no longer exists, we fall back to out own resolution, to give // user chance to leave the non-existing directory. EnsureLocation(); } catch(...) { if (FTerminal->Active) { Directory = AbsolutePath(Directory, false); } else { throw; } } DoChangeDirectory(Directory); // make next ReadCurrentDirectory retrieve actual server-side current directory FReadCurrentDirectory = true; }
Finally I'd be really thankful if it were possible to implement the property switch spoken of in order to improve efficiency in an automated usage scenario.
With kind regards, Williams4411
On Model 7050
ftp> sys 215 UNIX Type: L8 Version: Linux 2.6.19.2