Commit 28023b68 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Merge remote-tracking branch 'origin/release/20.04'

Ragnar, Elvis, please remember to do the merges, if it wasn't because I'm
stubborn when creating new branches we would have lost this for 20.08
and future because the code was only in 20.04

CCMAIL: rthomsen6@gmail.com
CCMAIL: elvis.angelaccio@kde.org
parents 5aee0f5d 5be9eb70
......@@ -99,17 +99,47 @@ bool LibarchivePlugin::list()
emit progress(float(archive_filter_bytes(m_archiveReader.data(), -1))/float(compressedArchiveSize));
m_cachedArchiveEntryCount++;
archive_read_data_skip(m_archiveReader.data());
// Skip the entry data.
int readSkipResult = archive_read_data_skip(m_archiveReader.data());
if (readSkipResult != ARCHIVE_OK) {
qCCritical(ARK) << "Error while skipping data for entry:"
<< QString::fromWCharArray(archive_entry_pathname_w(aentry))
<< readSkipResult
<< QLatin1String(archive_error_string(m_archiveReader.data()));
if (!emitCorruptArchive()) {
return false;
}
}
}
if (result != ARCHIVE_EOF) {
qCWarning(ARK) << "Could not read until the end of the archive:" << QLatin1String(archive_error_string(m_archiveReader.data()));
return false;
qCCritical(ARK) << "Error while reading archive:"
<< result
<< QLatin1String(archive_error_string(m_archiveReader.data()));
if (!emitCorruptArchive()) {
return false;
}
}
return archive_read_close(m_archiveReader.data()) == ARCHIVE_OK;
}
bool LibarchivePlugin::emitCorruptArchive()
{
Kerfuffle::LoadCorruptQuery query(filename());
emit userQuery(&query);
query.waitForResponse();
if (!query.responseYes()) {
emit cancelled();
archive_read_close(m_archiveReader.data());
return false;
} else {
emit progress(1.0);
return true;
}
}
bool LibarchivePlugin::addFiles(const QVector<Archive::Entry*> &files, const Archive::Entry *destination, const CompressionOptions &options, uint numberOfEntriesToAdd)
{
Q_UNUSED(files)
......
......@@ -94,6 +94,7 @@ private Q_SLOTS:
private:
int extractionFlags() const;
QString convertCompressionName(const QString &method);
bool emitCorruptArchive();
int m_cachedArchiveEntryCount;
qlonglong m_currentExtractedFilesSize;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment