[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kioslave/ftp
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2004-06-14 4:43:37
Message-ID: 20040614044337.1102712661 () office ! kde ! org
[Download RAW message or body]
CVS commit by adawit:
- Fix both BR# 24170 and 58492.
o Return ERR_DIR_ALREADY_EXIST when mkdir cannot create a directory because it already exists.
o Support download of dynamically created archives (files).
CCMAIL: 24170-done@bugs.kde.org
CCMAIL: 58492-done@bugs.kde.org
M +30 -23 ftp.cc 1.209
--- kdelibs/kioslave/ftp/ftp.cc #1.208:1.209
@@ -1205,4 +1205,16 @@ void Ftp::mkdir( const KURL & url, int p
if( !ftpSendCmd( buf ) || (m_iRespType != 2) )
{
+ QString currentPath( m_currentPath );
+
+ // Check whether or not mkdir failed because
+ // the directory already exists...
+ if( ftpFolder( path, false ) )
+ {
+ error( ERR_DIR_ALREADY_EXIST, path );
+ // Change the directory back to what it was...
+ (void) ftpFolder( currentPath, false );
+ return;
+ }
+
error( ERR_COULD_NOT_MKDIR, path );
return;
@@ -1412,9 +1424,9 @@ void Ftp::ftpStatAnswerNotFound( const Q
// where listing permissions are denied, but downloading is still possible.
ftpShortStatAnswer( filename, false /*file, not dir*/ );
+
+ return;
}
- else
- {
+
error( ERR_DOES_NOT_EXIST, path );
- }
}
@@ -1931,24 +1943,19 @@ void Ftp::get( const KURL & url )
Ftp::StatusCode Ftp::ftpGet(int& iError, int iCopyFile, const KURL& url, KIO::fileoffset_t llOffset)
{
- if( !ftpOpenConnection(loginImplicit) ) // calls error() by itself!
+ // Calls error() by itself!
+ if( !ftpOpenConnection(loginImplicit) )
return statusServerError;
- // try to find the size of the file (and check that it exists at the same time)
- // 550 is "File does not exist"/"not a plain file"
- // If we got something else, maybe SIZE isn't supported.
- if ( !ftpSize( url.path(), '?' ) && (m_iRespCode == 550) )
- {
- // Not a file, or doesn't exist. We need to find out.
- if( ftpFolder(url.path(), false) )
+ // Try to find the size of the file (and check that it exists at
+ // the same time). If we get back a 550, "File does not exist"
+ // or "not a plain file", check if it is a directory. If it is a
+ // directory, return an error; otherwise simply try to retrieve
+ // the request...
+ if ( !ftpSize( url.path(), '?' ) && (m_iRespCode == 550) &&
+ ftpFolder(url.path(), false) )
{
// Ok it's a dir in fact
kdDebug(7102) << "ftpGet: it is a directory in fact" << endl;
iError = ERR_IS_DIRECTORY;
- }
- else
- {
- kdDebug(7102) << "ftpGet: file doesn't exist" << endl;
- iError = ERR_DOES_NOT_EXIST;
- }
return statusServerError;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic