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

Don't call del when asked to overwrite a destination file in rename. Otherwise,

the finished signal from calling del will cause the bug reported in 255296.

CCBUG: 255296

(cherry picked from commit 39b75552)
parent fa5321af
......@@ -1586,7 +1586,7 @@ void sftpProtocol::mkdir(const KUrl &url, int permissions) {
}
void sftpProtocol::rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags) {
kDebug(KIO_SFTP_DB) << "rename " << src << " to " << dest;
kDebug(KIO_SFTP_DB) << "rename " << src << " to " << dest << flags;
openConnection();
if (!mConnected) {
......@@ -1608,7 +1608,18 @@ void sftpProtocol::rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags
return;
}
del(dest, sb->type == SSH_FILEXFER_TYPE_DIRECTORY ? true : false);
// Delete the existing destination file/dir...
if (sb->type == SSH_FILEXFER_TYPE_DIRECTORY) {
if (sftp_rmdir(mSftp, qdest.constData()) < 0) {
reportError(dest, sftp_get_error(mSftp));
return;
}
} else {
if (sftp_unlink(mSftp, qdest.constData()) < 0) {
reportError(dest, sftp_get_error(mSftp));
return;
}
}
}
sftp_attributes_free(sb);
......
Markdown is supported
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