diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp --- a/src/core/copyjob.cpp +++ b/src/core/copyjob.cpp @@ -1599,6 +1599,7 @@ qCDebug(KIO_COPYJOB_DEBUG); // Take the first file in the list QList::Iterator it = files.begin(); + const auto fileSystem = KFileSystemType::fileSystemType(m_globalDest.toString()); // Is this URL on the skip list ? while (it != files.end() && !bCopyFile) { const QString destFile = (*it).uDest.path(); @@ -1606,6 +1607,13 @@ if (!bCopyFile) { it = files.erase(it); } + + if (fileSystem == KFileSystemType::Fat && (*it).size > ((1ul << 32) -1)) { // (1ul << 32 -1) = 4 GB + q->setError(ERR_FILE_TOO_LARGE_FOR_FAT32); + q->setErrorText(m_globalDest.toDisplayString()); + q->emitResult(); + return; + } } if (bCopyFile) { // any file to create, finally ? @@ -1616,7 +1624,6 @@ q->emitResult(); return; } - //TODO check if dst mount is msdos and (*it).size exceeds it's limits } const QUrl &uSource = (*it).uSource; diff --git a/src/core/global.h b/src/core/global.h --- a/src/core/global.h +++ b/src/core/global.h @@ -245,7 +245,8 @@ ERR_DROP_ON_ITSELF = KJob::UserDefinedError + 70, ///< from KIO::DropJob, @since 5.6 ERR_CANNOT_MOVE_INTO_ITSELF = KJob::UserDefinedError + 71, ///< emitted by KIO::move, @since 5.18 ERR_PASSWD_SERVER = KJob::UserDefinedError + 72, ///< returned by SlaveBase::openPasswordDialogV2, @since 5.24 - ERR_CANNOT_CREATE_SLAVE = KJob::UserDefinedError + 73 ///< used by Slave::createSlave, @since 5.30 + ERR_CANNOT_CREATE_SLAVE = KJob::UserDefinedError + 73, ///< used by Slave::createSlave, @since 5.30 + ERR_FILE_TOO_LARGE_FOR_FAT32 = KJob::UserDefinedError + 74 ///< @since 5.52 }; /** diff --git a/src/core/job_error.cpp b/src/core/job_error.cpp --- a/src/core/job_error.cpp +++ b/src/core/job_error.cpp @@ -245,8 +245,11 @@ case KIO::ERR_CANNOT_CREATE_SLAVE: result = i18n("Unable to create io-slave. %1", errorText); break; + case KIO::ERR_FILE_TOO_LARGE_FOR_FAT32: + result = xi18n("Cannot transfer %1 because it is too large. The destination filesystem only supports files up to 4GB", errorText); + break; default: - result = i18n("Unknown error code %1\n%2\nPlease send a full bug report at https://bugs.kde.org.", errorCode, errorText); + result = i18n("Unknown error code %1\n%2\nPlease send a full bug report at https://bugs.kde.org.", errorCode, errorText); break; } @@ -1069,6 +1072,13 @@ solutions << sUpdate << sSysadmin; break; + case KIO::ERR_FILE_TOO_LARGE_FOR_FAT32: + errorName = xi18n("Cannot transfer %1", errorText); + description = xi18n("The file %1 cannot be transeferred," + " because the destination filesystem does not support files that large", errorText); + solutions << i18n("Reformat the destination drive to use a filesystem that supports files that large."); + break; + default: // fall back to the plain error... errorName = i18n("Undocumented Error");