kutils: assume that KArchive::list() filtered the entries when recursing

the conditionals were there to maybe match with and without trailing slash
but KArchive::list() works correctly for the fomats that do not add
trailing slash to directories aswell

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-25 23:33:12 +02:00
parent 0cbc869f50
commit 55432743c0

View file

@ -744,9 +744,7 @@ bool KArchive::remove(const QStringList &paths) const
if (path.endsWith(QLatin1Char('/')) || S_ISDIR(KArchive::entry(path).mode)) {
const QByteArray pathbytes = QFile::encodeName(path);
foreach (const KArchiveEntry &karchiveentry, KArchive::list(path)) {
if (karchiveentry.pathname.startsWith(pathbytes)) {
recursivepaths.append(QFile::decodeName(karchiveentry.pathname));
}
recursivepaths.append(QFile::decodeName(karchiveentry.pathname));
}
} else {
recursivepaths << path;
@ -873,9 +871,7 @@ bool KArchive::extract(const QStringList &paths, const QString &destination, con
if (path.endsWith(QLatin1Char('/')) || S_ISDIR(KArchive::entry(path).mode)) {
const QByteArray pathbytes = QFile::encodeName(path);
foreach (const KArchiveEntry &karchiveentry, KArchive::list(path)) {
if (karchiveentry.pathname.startsWith(pathbytes)) {
recursivepaths.append(QFile::decodeName(karchiveentry.pathname));
}
recursivepaths.append(QFile::decodeName(karchiveentry.pathname));
}
} else {
recursivepaths << path;