Make kio_ftp work with ftp server that don't support absolute path with SIZE command
Review Request #116524 - Created March 2, 2014 and submitted
This patch changes Ftp::ftpSize such that it has support for servers that do not allow absolute paths with the SIZE command. That means when sending the command "SIZE /somefile" fails, it will try sending "SIZE somefile" before giving up. See bug report for details.
Installed Ftp server from bug report on an Android device and run tests.
This is surely wrong. If you're in /home/dfaure (as the CWD would be, by default, on non-anonymous FTP) and you're downloading a file /home/dfaure/dir1/dir2/file.txt then surely you want to call SIZE dir1/dir2/file.txt and not SIZE home/dfaure/dir1/dir2/file.txt It has to be relative to the CWD, not just "skip the first slash", which only works if the CWD is "/". This gives two alternatives for the fix: make this code relative to the current CWD whatever it is, or call ftpFolder() with the directory name (e.g. /home/dfaure/dir1/dir2) followed by SIZE with just the filename. The latter sounds like it might work better on android (if it doesn't support absolute paths, maybe it doesn't support ../../foo/bar.txt either?).
Given that m_currentPath might not end with a '/' (as indicated by the if statement 2 lines below), this is buggy. m_currentPath="/home/adawit/dev" path="/home/adawit/development" Let's assume both dirs exist. ++pos and path.mid(pos) will lead to "lopment". You should make a local slash-terminated copy of m_currentPath before calling startsWith().