- fix crashes when adding a new network folder (kdebug:162285) - KFileMetaInfo freezes when Strigi indexes non-sequential files (kdebug:163050) - renaming in FTP overwrites existing files without confirmation (kdebug:127793)
31 lines
949 B
Diff
31 lines
949 B
Diff
--- kdelibs/kioslave/ftp/ftp.cpp 2008/06/09 12:31:52 818728
|
|
+++ kdelibs/kioslave/ftp/ftp.cpp 2008/06/09 12:41:22 818729
|
|
@@ -1041,12 +1041,23 @@
|
|
error( ERR_CANNOT_RENAME, src.path() );
|
|
}
|
|
|
|
-bool Ftp::ftpRename( const QString & src, const QString & dst, KIO::JobFlags )
|
|
+bool Ftp::ftpRename( const QString & src, const QString & dst, KIO::JobFlags jobFlags)
|
|
{
|
|
- // TODO honor overwrite
|
|
- assert( m_bLoggedOn );
|
|
+ assert( m_bLoggedOn );
|
|
+
|
|
+ // Must check if dst already exists, RNFR+RNTO overwrites by default (#127793).
|
|
+ if (!(jobFlags & KIO::Overwrite)) {
|
|
+ if (ftpSize(dst, 'I')) {
|
|
+ error(ERR_FILE_ALREADY_EXIST, dst);
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ if (ftpFolder(dst, false)) {
|
|
+ error(ERR_DIR_ALREADY_EXIST, dst);
|
|
+ return false;
|
|
+ }
|
|
|
|
- int pos = src.lastIndexOf("/");
|
|
+ int pos = src.lastIndexOf('/');
|
|
if( !ftpFolder(src.left(pos+1), false) )
|
|
return false;
|
|
|