A user reported that several
FTPHost methods return wrong results when
given an empty path, for example
The reason for the odd behavior is that all the
FTPHostmethods immediately change a path argument to an absolute path without checking the argument beforehand. Therefore, turning
""into an absolute path always gives the absolute path of the current directory.
To fix this problem, the incoming path should be compared against
""and if that's the value, the path should be considered non-existent, or an exception should be raised. The behavior will depend on the concrete method. For example,
FTPHost.openprobably should raise a
For the record: Curiously, using an empty path under Linux on an ext4 file system results in a "file not found" error, even when creating a file, for example with
Falsefor an empty path.
- Most public methods raise an
FTPIOErrorfor an empty path. The exception is
FTPHost.chdir. The reason is explained in commit d615279cd0f7dfc560f9b4eac3bd88572d25750b.