summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-11-26 20:18:34 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-11-26 21:04:30 +0100
commit86c682273d907c77404637c89e584047de1c1099 (patch)
treeb46a839c166f869a7471fd35ab7dfca357331e2f /oox
parentef79b9c55828d39de3d86cedd125f2f32e6b259a (diff)
tdf#96401: allow to detect a broken ZIP package
In deep detection, first check if it's a broken ZIP package. If it is, set the RepairPackage media descriptor property to true. Pass the RepairPackage value to the OOXML filter detection. Change-Id: Ic958283f3cce92ac29ce93ac330cc9e409e3eb78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159976 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/core/filterdetect.cxx3
-rw-r--r--oox/source/helper/zipstorage.cxx4
2 files changed, 4 insertions, 3 deletions
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 7c52f81e615d..cbee8cf1d933 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -428,7 +428,8 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq
Reference< XInputStream > xInputStream( extractUnencryptedPackage( aMediaDescriptor ), UNO_SET_THROW );
// stream must be a ZIP package
- ZipStorage aZipStorage( mxContext, xInputStream );
+ ZipStorage aZipStorage(mxContext, xInputStream,
+ aMediaDescriptor.getUnpackedValueOrDefault("RepairPackage", false));
if( aZipStorage.isStorage() )
{
// create the fast parser, register the XML namespaces, set document handler
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index 10f7d79c25f1..db73b14bdd6c 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -38,7 +38,7 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStream ) :
+ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStream, bool bRepairStorage ) :
StorageBase( rxInStream, false )
{
OSL_ENSURE( rxContext.is(), "ZipStorage::ZipStorage - missing component context" );
@@ -61,7 +61,7 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R
implementation of relations handling.
*/
mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
- ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext, false);
+ ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext, bRepairStorage);
}
catch (Exception const&)
{