summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-01 20:55:40 +0600
committerXisco Fauli <xiscofauli@libreoffice.org>2024-02-02 12:50:37 +0100
commitd6c47949fc57d0fd115dc0f2f99ad8da89eab8bc (patch)
tree8fd51fcaf56237bb5889c071bf3b5aa06cc9624d /oox
parent6d739a60bb4014f5b42e75ef909a2f5f7a1fb081 (diff)
tdf#154587: allow directory entries in ZIP packages
The problem in the bugdoc was the directory entries. These entries are valid in ZIP packages (even if not common); they may be useful to e.g. define per-directory permissions (ACLs). In normal mode, ZipFile reads central directory; there we can read if the entry has FAT file attributes; and then, if the entry is a directory. Then it is OK to skip it. In repair mode, central directory is not used, local file headers don't contain a "directory" flag. A workaround is used, checking if there are entries that represent directories of other entries. Also this change fixes some places that didn't pass the recovery flag correctly. Change-Id: I324671841a2c4d0f279b03801d95c8f2eeb99b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162888 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 747463809e50c132557a95dcee6709a1fa82d760) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162897 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/core/xmlfilterbase.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 2c0cfa9732eb..55e43cc08921 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -287,8 +287,10 @@ void XmlFilterBase::importDocumentProperties()
rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) );
xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc );
Reference< XComponent > xModel = getModel();
+ const bool repairPackage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
Reference< XStorage > xDocumentStorage (
- ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) );
+ ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
+ OFOPXML_STORAGE_FORMAT_STRING, xInputStream, {}, repairPackage));
Reference< XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.document.OOXMLDocumentPropertiesImporter",
xContext);