Commit 13187db5 authored by Wolfgang Bauer's avatar Wolfgang Bauer
Browse files

Fix destination filesystem type check for downloads bigger than 4 GiB

`m_dest` is a QUrl, we need to use `toLocalFile()` to get a local path.
`toString()` results in a URL instead ("file://...") which causes the
mountpoint lookup to fail.

Also, the check whether the mountpoint was found was reversed. It
actually tried to compare the filesystem type when the mount point was
*not* found, resulting in a crash because of the nullptr dereference.

BUG: 444591
FIXED-IN: 21.12.1
parent 5faf9111
Pipeline #117832 failed with stage
in 1 minute and 22 seconds
......@@ -272,8 +272,8 @@ void DataSourceFactory::start()
//check if the filesystem supports a file of m_size
const static KIO::filesize_t maxFatSize = 4294967295;
if (m_size > maxFatSize) {
KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(m_dest.adjusted(QUrl::RemoveFilename).toString());
if (!mountPoint) {
KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(m_dest.adjusted(QUrl::RemoveFilename).toLocalFile());
if (mountPoint) {
if (mountPoint->mountType() == "vfat") {//TODO check what is reported on Windows for vfat
stop();
KMessageBox::error(nullptr, i18n("Filesize is larger than maximum file size supported by VFAT."), i18n("Error"));
......@@ -282,7 +282,7 @@ void DataSourceFactory::start()
}
}
QFile::resize(m_dest.toString(), m_size);//TODO should we keep that?
QFile::resize(m_dest.toLocalFile(), m_size);//TODO should we keep that?
m_speedTimer->start();
foreach (TransferDataSource *source, m_sources) {
......
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