include/oox/helper/zipstorage.hxx | 2 +- oox/source/core/filterdetect.cxx | 11 ++++++----- oox/source/core/xmlfilterbase.cxx | 4 +++- oox/source/dump/pptxdumper.cxx | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-)
New commits: commit 975bbafaae39f4dc5d9120b4347498b07e7e2426 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Dec 14 12:54:15 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Dec 14 14:11:07 2023 +0100 Related: tdf#76115 Also pass RepairPackage to FilterDetect And drop the default argument value from ZipStorage ctor. Always pass it explicitly. Change-Id: I8bcf78dc4db7763567f9d6873841d75c328ede7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160760 Tested-by: Mike Kaganski <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> diff --git a/include/oox/helper/zipstorage.hxx b/include/oox/helper/zipstorage.hxx index dabb714d7db8..dd56a1f75a71 100644 --- a/include/oox/helper/zipstorage.hxx +++ b/include/oox/helper/zipstorage.hxx @@ -44,7 +44,7 @@ public: explicit ZipStorage( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::io::XInputStream >& rxInStream, - bool bRepairStorage = false ); + bool bRepairStorage ); explicit ZipStorage( const css::uno::Reference< css::uno::XComponentContext >& rxContext, diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index cbee8cf1d933..6eab25684435 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -269,9 +269,9 @@ FilterDetect::~FilterDetect() namespace { -bool lclIsZipPackage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) +bool lclIsZipPackage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, bool bRepairPackage ) { - ZipStorage aZipStorage( rxContext, rxInStrm ); + ZipStorage aZipStorage(rxContext, rxInStrm, bRepairPackage); return aZipStorage.isStorage(); } @@ -316,9 +316,10 @@ comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( co Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescriptor& rMediaDescriptor ) const { + const bool bRepairPackage(rMediaDescriptor.getUnpackedValueOrDefault("RepairPackage", false)); // try the plain input stream Reference<XInputStream> xInputStream( rMediaDescriptor[ MediaDescriptor::PROP_INPUTSTREAM ], UNO_QUERY ); - if( !xInputStream.is() || lclIsZipPackage( mxContext, xInputStream ) ) + if (!xInputStream.is() || lclIsZipPackage(mxContext, xInputStream, bRepairPackage)) return xInputStream; // check if a temporary file is passed in the 'ComponentData' property @@ -326,7 +327,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript if( xDecrypted.is() ) { Reference<XInputStream> xDecryptedInputStream = xDecrypted->getInputStream(); - if( lclIsZipPackage( mxContext, xDecryptedInputStream ) ) + if (lclIsZipPackage(mxContext, xDecryptedInputStream, bRepairPackage)) return xDecryptedInputStream; } @@ -380,7 +381,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript rMediaDescriptor.setComponentDataEntry( "DecryptedPackage", Any( xTempStream ) ); Reference<XInputStream> xDecryptedInputStream = xTempStream->getInputStream(); - if( lclIsZipPackage( mxContext, xDecryptedInputStream ) ) + if (lclIsZipPackage(mxContext, xDecryptedInputStream, bRepairPackage)) return xDecryptedInputStream; } } diff --git a/oox/source/dump/pptxdumper.cxx b/oox/source/dump/pptxdumper.cxx index c65b792063b2..5a386359d477 100644 --- a/oox/source/dump/pptxdumper.cxx +++ b/oox/source/dump/pptxdumper.cxx @@ -113,7 +113,7 @@ Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference { if( rxContext.is() && rxInStrm.is() ) { - StorageRef xStrg = std::make_shared<ZipStorage>( rxContext, rxInStrm ); + StorageRef xStrg = std::make_shared<ZipStorage>( rxContext, rxInStrm, false ); ConfigRef xCfg = std::make_shared<Config>( DUMP_PPTX_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName ); DumperBase::construct( xCfg ); } commit 27632654feda626131196c996e3f815f3602d248 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Dec 14 11:51:42 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Dec 14 14:10:55 2023 +0100 tdf#76115: pass RepairPackage property from media descriptor to ZipStorage See commit 86c682273d907c77404637c89e584047de1c1099. Change-Id: I51a3beb00f635554ac73cc9ea957e18fb8e84349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160757 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 93b5816812a1..2c0cfa9732eb 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -1014,7 +1014,9 @@ bool XmlFilterBase::implFinalizeExport( MediaDescriptor& rMediaDescriptor ) StorageRef XmlFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const { - return std::make_shared<ZipStorage>( getComponentContext(), rxInStream ); + return std::make_shared<ZipStorage>( + getComponentContext(), rxInStream, + getMediaDescriptor().getUnpackedValueOrDefault("RepairPackage", false)); } StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
