Commit cfa37065 authored by Christoph Feck's avatar Christoph Feck Committed by Albert Astals Cid
Browse files

Fix cbr (rar) listing with unrar 5

The new unrar version includes the paths in its "bare listing" (unrar lb), while it still extracts only the filename without the path. Thus, the Unrar::list() function fails. This patch strips the path away.

REVIEW: 113163
BUGS: 325677
FIXED-IN: 4.11.3
parent c9012d2b
......@@ -11,6 +11,7 @@
#include <QtCore/QEventLoop>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QRegExp>
#include <kdebug.h>
......@@ -133,8 +134,11 @@ QStringList Unrar::list()
const QStringList listFiles = helper->kind->processListing( QString::fromLocal8Bit( mStdOutData ).split( '\n', QString::SkipEmptyParts ) );
QStringList newList;
Q_FOREACH ( const QString &f, listFiles ) {
if ( QFile::exists( mTempDir->name() + f ) ) {
newList.append( f );
// Extract all the files to mTempDir regardless of their path inside the archive
// This will break if ever an arvhice with two files with the same name in different subfolders
QFileInfo fi( f );
if ( QFile::exists( mTempDir->name() + fi.fileName() ) ) {
newList.append( fi.fileName() );
}
}
return newList;
......
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