diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp --- a/src/core/copyjob.cpp +++ b/src/core/copyjob.cpp @@ -1573,36 +1573,44 @@ if (!newjob) { return; } - } else if (!(*it).linkDest.isEmpty() && - (uSource.scheme() == uDest.scheme()) && - (uSource.host() == uDest.host()) && - (uSource.port() == uDest.port()) && - (uSource.userName() == uDest.userName()) && - (uSource.password() == uDest.password())) - // Copying a symlink - only on the same protocol/host/etc. (#5601, downloading an FTP file through its link), - { - KIO::SimpleJob *newJob = KIO::symlink((*it).linkDest, uDest, flags | HideProgressInfo /*no GUI*/); - Scheduler::setJobPriority(newJob, 1); - newjob = newJob; - //qDebug() << "Linking target=" << (*it).linkDest << "link=" << uDest; - m_currentSrcURL = QUrl::fromUserInput((*it).linkDest); - m_currentDestURL = uDest; - m_bURLDirty = true; - //emit linking( this, (*it).linkDest, uDest ); - //Observer::self()->slotCopying( this, m_currentSrcURL, uDest ); // should be slotLinking perhaps - m_bCurrentOperationIsLink = true; - // NOTE: if we are moving stuff, the deletion of the source will be done in slotResultCopyingFiles } else if (m_mode == CopyJob::Move) { // Moving a file - KIO::FileCopyJob *moveJob = KIO::file_move(uSource, uDest, permissions, flags | HideProgressInfo/*no GUI*/); - moveJob->setSourceSize((*it).size); - moveJob->setModificationTime((*it).mtime); // #55804 - newjob = moveJob; - //qDebug() << "Moving" << uSource << "to" << uDest; - //emit moving( this, uSource, uDest ); - m_currentSrcURL = uSource; - m_currentDestURL = uDest; - m_bURLDirty = true; - //Observer::self()->slotMoving( this, uSource, uDest ); + // A copy operation should copy the file contents and not just + // the links, ( #315482 ), so restrict this check to + // CopyJob::Move only. + // + // This is also done to emulate the behaviour of the UNIX cp + // command and by common conventions. + if (!(*it).linkDest.isEmpty() && + (uSource.scheme() == uDest.scheme()) && + (uSource.host() == uDest.host()) && + (uSource.port() == uDest.port()) && + (uSource.userName() == uDest.userName()) && + (uSource.password() == uDest.password())) + // Copying a symlink - only on the same protocol/host/etc. (#5601, downloading an FTP file through its link), + { + KIO::SimpleJob *newJob = KIO::symlink((*it).linkDest, uDest, flags | HideProgressInfo /*no GUI*/); + Scheduler::setJobPriority(newJob, 1); + newjob = newJob; + //qDebug() << "Linking target=" << (*it).linkDest << "link=" << uDest; + m_currentSrcURL = QUrl::fromUserInput((*it).linkDest); + m_currentDestURL = uDest; + m_bURLDirty = true; + //emit linking( this, (*it).linkDest, uDest ); + //Observer::self()->slotCopying( this, m_currentSrcURL, uDest ); // should be slotLinking perhaps + m_bCurrentOperationIsLink = true; + // NOTE: if we are moving stuff, the deletion of the source will be done in slotResultCopyingFiles + } else { + KIO::FileCopyJob *moveJob = KIO::file_move(uSource, uDest, permissions, flags | HideProgressInfo/*no GUI*/); + moveJob->setSourceSize((*it).size); + moveJob->setModificationTime((*it).mtime); // #55804 + newjob = moveJob; + //qDebug() << "Moving" << uSource << "to" << uDest; + //emit moving( this, uSource, uDest ); + m_currentSrcURL = uSource; + m_currentDestURL = uDest; + m_bURLDirty = true; + //Observer::self()->slotMoving( this, uSource, uDest ); + } } else { // Copying a file KIO::FileCopyJob *copyJob = KIO::file_copy(uSource, uDest, permissions, flags | HideProgressInfo/*no GUI*/); copyJob->setParentJob(q); // in case of rename dialog