diff --git a/autotests/jobtest.cpp b/autotests/jobtest.cpp --- a/autotests/jobtest.cpp +++ b/autotests/jobtest.cpp @@ -1096,7 +1096,7 @@ #else QCOMPARE(job->totalFiles(), 7ULL); // see expected result in listRecursive() above QCOMPARE(job->totalSubdirs(), 4ULL); // see expected result in listRecursive() above - QVERIFY2(job->totalSize() >= 60, qPrintable(QString("totalSize was %1").arg(job->totalSize()))); // size of subdir entries is filesystem dependent. E.g. this is 16428 with ext4 but only 272 with xfs, and 63 on FreeBSD + QCOMPARE(job->totalSize(), 4 * 11); // expected result in listRecursive() has 4 files with "hello world" #endif qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); diff --git a/src/core/directorysizejob.cpp b/src/core/directorysizejob.cpp --- a/src/core/directorysizejob.cpp +++ b/src/core/directorysizejob.cpp @@ -158,11 +158,8 @@ } const KIO::filesize_t size = entry.numberValue(KIO::UDSEntry::UDS_SIZE, 0); const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME); - if (name == QLatin1String(".")) { - m_totalSize += size; - //qDebug() << "'.': added" << size << "->" << m_totalSize; - } else if (name != QLatin1String("..")) { - if (!entry.isLink()) { + if (name != QLatin1String("..") && name != QLatin1String(".")) { + if (!entry.isLink() && !entry.isDir()) { m_totalSize += size; } if (!entry.isDir()) {