QZipReader: extractAll should not create dir for root entries

QZipReader::extractAll handles zip files without dir entries in a way that
it creates the dirs automatically.
Fixed this logic for files in the root of the zip file by skipping those.

Fixes: QTBUG-131008
Change-Id: Ia7cde0f2762f4566564e8524b71f43834158f09c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Matthias Behr 2024-11-16 08:44:19 +01:00
parent 8a535cc104
commit 4f9cbd5b28

View File

@ -1009,6 +1009,8 @@ bool QZipReader::extractAll(const QString &destinationDir) const
// need to recreate directory structure based on the file paths.
if (hasDirs && !foundDirs) {
for (const FileInfo &fi : allFiles) {
if (!fi.filePath.contains(u"/"))
continue;
const auto dirPath = fi.filePath.left(fi.filePath.lastIndexOf(u"/"));
if (!baseDir.mkpath(dirPath))
return false;