[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ark] plugins/clizipplugin: clizip: Detect whether an entry is a
From:       Raphael Kubo da Costa <rakuco () FreeBSD ! org>
Date:       2011-08-23 20:24:08
Message-ID: 20110823202408.4BB4DA60A4 () git ! kde ! org
[Download RAW message or body]

Git commit 8e8819046d902f77bb8fa01215efc461b70bdc68 by Raphael Kubo da Costa.
Committed on 23/08/2011 at 22:16.
Pushed by rkcosta into branch 'master'.

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

M  +5    -1    plugins/clizipplugin/cliplugin.cpp

http://commits.kde.org/ark/8e8819046d902f77bb8fa01215efc461b70bdc68

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()) {

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic