Commit d6453435 authored by Dawit Alemayehu's avatar Dawit Alemayehu
Browse files

Whenever possible, use relative paths for SIZE requests, e.g. SIZE foo/bar.txt

BUG: 326292
FIXED-IN: 4.12.4
REVIEW: 116524
parent 61bbbda6
......@@ -2265,11 +2265,24 @@ bool Ftp::ftpSize( const QString & path, char mode )
if( !ftpDataMode(mode) )
return false;
// Some servers do not allow absolute path for SIZE; so we use
// relative paths whenever possible. #326292
QString currentPath(m_currentPath);
if (!currentPath.endsWith(QLatin1Char('/'))) {
currentPath += QLatin1Char('/');
}
QByteArray buf;
buf = "SIZE ";
buf += remoteEncoding()->encode(path);
if( !ftpSendCmd( buf ) || (m_iRespType != 2) )
return false;
if (path.startsWith(currentPath)) {
buf += remoteEncoding()->encode(path.mid(currentPath.length()));
} else {
buf += remoteEncoding()->encode(path);
}
if (!ftpSendCmd(buf) || m_iRespType != 2) {
return false;
}
// skip leading "213 " (response code)
QByteArray psz (ftpResponse(4));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment