Commit c3111575 authored by Ragnar Thomsen's avatar Ragnar Thomsen
Browse files

Enable support for application/x-archive

Read-only support for application/x-archive (AR archives) which is
mostly used for static libraries (*.a) was enabled in libarchiveplugin.

Due to static libraries containing the two entries "/" and "//", code
was added to skip these entries to avoid the "absolute path" error. This
enables extraction of this archive type.

FEATURE:
Differential Revision: D2904
parent 7bba06c6
......@@ -4,7 +4,7 @@ include_directories(${LibArchive_INCLUDE_DIRS})
set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "application/x-tar;application/x-compressed-tar;application/x-bzip-compressed-tar;application/x-tarz;application/x-xz-compressed-tar;")
set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-lzma-compressed-tar;application/x-lzip-compressed-tar;application/x-tzo;application/x-lrzip-compressed-tar;")
set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "application/vnd.debian.binary-package;application/x-deb;application/x-cd-image;application/x-bcpio;application/x-cpio;application/x-cpio-compressed;application/x-sv4cpio;application/x-sv4crc;")
set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;application/x-xar;application/x-iso9660-appimage;")
set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;application/x-xar;application/x-iso9660-appimage;application/x-archive;")
if(LibArchive_VERSION VERSION_EQUAL "3.2.0" OR
LibArchive_VERSION VERSION_GREATER "3.2.0")
......@@ -37,7 +37,8 @@ set(SUPPORTED_READONLY_MIMETYPES
\"application/vnd.debian.binary-package\",
\"application/vnd.ms-cab-compressed\",
\"application/x-xar\",
\"application/x-iso9660-appimage")
\"application/x-iso9660-appimage\",
\"application/x-archive")
# NOTE: the first double-quotes of the first mime and the last
# double-quotes of the last mime must NOT be escaped.
......
......@@ -224,6 +224,13 @@ bool LibarchivePlugin::extractFiles(const QList<Archive::Entry*> &files, const Q
entryName.remove(0, 2);
}
// Static libraries (*.a) contain the two entries "/" and "//".
// We just skip these to allow extracting this archive type.
if (entryName == QLatin1String("/") || entryName == QLatin1String("//")) {
archive_read_data_skip(m_archiveReader.data());
continue;
}
// For now we just can't handle absolute filenames in a tar archive.
// TODO: find out what to do here!!
if (entryName.startsWith(QLatin1Char( '/' ))) {
......
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