diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-14 12:54:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-14 14:11:07 +0100 |
commit | 975bbafaae39f4dc5d9120b4347498b07e7e2426 (patch) | |
tree | 6727ca8492febee147bc8433d15c1fe0c7fffba4 /oox | |
parent | 27632654feda626131196c996e3f815f3602d248 (diff) |
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 <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/filterdetect.cxx | 11 | ||||
-rw-r--r-- | oox/source/dump/pptxdumper.cxx | 2 |
2 files changed, 7 insertions, 6 deletions
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 ); } |