From 4f9cbd5b2892f0f72c74db05d05c67f25e7c99e7 Mon Sep 17 00:00:00 2001 From: Matthias Behr Date: Sat, 16 Nov 2024 08:44:19 +0100 Subject: [PATCH] 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 --- src/corelib/io/qzip.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/io/qzip.cpp b/src/corelib/io/qzip.cpp index 173563ec29a..1e3d5f5859e 100644 --- a/src/corelib/io/qzip.cpp +++ b/src/corelib/io/qzip.cpp @@ -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;