Commit cb74426e authored by Jakub Staroń's avatar Jakub Staroń Committed by Albert Astals Cid
Browse files

Don't set permissions of extracted zip files when there are none

Some zip implementations like .NET stdlib don't preserve unix permissions (at least by default) resulting in zip files with mode `0`.  
So instead of making files that can't be opened by anyone, this PR just doesn't change the permissions from default when attributes are `0` (which is not the same as `000` mode because attributes also should contain the file type)
parent 06e3a3b1
Pipeline #222151 passed with stage
in 1 minute and 46 seconds
......@@ -780,8 +780,10 @@ bool LibzipPlugin::extractEntry(zip_t *archive, const QString &entry, const QStr
// Inspired by fuse-zip source code: fuse-zip/lib/fileNode.cpp
switch (opsys) {
case ZIP_OPSYS_UNIX:
// Unix permissions are stored in the leftmost 16 bits of the external file attribute.
file.setPermissions(KIO::convertPermissions(attributes >> 16));
if (attributes != 0) {
// Unix permissions are stored in the leftmost 16 bits of the external file attribute.
file.setPermissions(KIO::convertPermissions(attributes >> 16));
}
break;
default: // TODO: non-UNIX.
break;
......
Supports Markdown
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