summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Kubo da Costa <rakuco@FreeBSD.org>2011-08-23 20:16:29 (GMT)
committerRaphael Kubo da Costa <rakuco@FreeBSD.org>2011-08-23 20:23:21 (GMT)
commit6324382670afad99172832574b7eb1a74814b0e9 (patch)
tree560e31b64813a18f47ebb524a28ebcb25d744588
parentdd0d3d1a8e31288af9647f7dc812c67df6c35920 (diff)
clizip: Detect whether an entry is a directory in a dumber way.
infozip seems to have some trouble indentifying whether some entries are directories in certain zip files, and outputs the wrong information in the entry's attributes. Simply checking if an entry's name ends in '/' seems to be more reliable. This also uncovered a crash in Dolphin, so I'm not closing the bug right now. The Ark side of the bug should be fixed in 4.7.1. CCBUG: 280354
-rw-r--r--plugins/clizipplugin/cliplugin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/clizipplugin/cliplugin.cpp b/plugins/clizipplugin/cliplugin.cpp
index 0cb30d0..8552562 100644
--- a/plugins/clizipplugin/cliplugin.cpp
+++ b/plugins/clizipplugin/cliplugin.cpp
@@ -114,7 +114,11 @@ bool CliPlugin::readListLine(const QString &line)
if (entryPattern.indexIn(line) != -1) {
ArchiveEntry e;
e[Permissions] = entryPattern.cap(1);
- e[IsDirectory] = (entryPattern.cap(1).at(0) == QLatin1Char( 'd' ));
+
+ // #280354: infozip may not show the right attributes for a given directory, so an entry
+ // ending with '/' is actually more reliable than 'd' bein in the attributes.
+ e[IsDirectory] = entryPattern.cap(10).endsWith(QLatin1Char('/'));
+
e[Size] = entryPattern.cap(4).toInt();
QString status = entryPattern.cap(5);
if (status[0].isUpper()) {