summaryrefslogtreecommitdiffstats
path: root/src/libs/installer
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-05-12 14:42:53 +0200
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-05-12 14:52:21 +0000
commitdd7921213c3ec2791f370632e5587f163b27c7d4 (patch)
treec47963a89ad7f2a3a13bac8ff3fe6f911ecc4041 /src/libs/installer
parenta99a2316954a30f5891d46685b80f2d41bdf932d (diff)
Fix archivegen recursive include of directories with filter.
Never pass recursive with true even if path is a directory, otherwise the path containing the file name part of the path is used as path to recurse and the actual file name is used as filter. For example: /path/to/doc -> Directory: /path/to -> Filter: doc Task-number: QTIFW-639 Change-Id: I60972eab0b34073b4c81a815ee83058df09d1eab Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r--src/libs/installer/lib7z_facade.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp
index a2811c19e..0428c256f 100644
--- a/src/libs/installer/lib7z_facade.cpp
+++ b/src/libs/installer/lib7z_facade.cpp
@@ -1348,12 +1348,13 @@ void Lib7z::createArchive(QFileDevice* archive, const QStringList &sourcePaths,
NWildcard::CCensor censor;
foreach (const QString &path, sourcePaths) {
- const UString sourcePath = QString2UString(QDir::toNativeSeparators(path));
- if (UString2QString(sourcePath) != QDir::toNativeSeparators(path))
- throw UString2QString(sourcePath).toLatin1().data();
- // Only pass recursive with true if path is a directory, otherwise we include the file and
- // possible folders located on the same directory level as the file into the created archive.
- censor.AddItem(true, sourcePath, QFileInfo(path).isDir());
+ const QString cleanPath = QDir::toNativeSeparators(QDir::cleanPath(path));
+ const UString nativePath = QString2UString(cleanPath);
+ if (UString2QString(nativePath) != cleanPath) {
+ throw SevenZipException(QCoreApplication::translate("Lib7z", "Could not convert"
+ "path: %1.").arg(path));
+ }
+ censor.AddItem(true /* always include item */, nativePath, false /* never recurse*/);
}
callback->setSourcePaths(sourcePaths);