diff options
Diffstat (limited to 'package')
-rw-r--r-- | package/inc/ZipFile.hxx | 2 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 11 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 12 |
3 files changed, 22 insertions, 3 deletions
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index 72b053363f61..b7612061b11c 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -56,7 +56,7 @@ class ZipEnumeration; class ZipFile { public: - enum class Checks { Default, CheckInsensitive }; + enum class Checks { Default, CheckInsensitive, TryCheckInsensitive }; private: rtl::Reference<comphelper::RefCountedMutex> m_aMutexHolder; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 7b55d2bea684..a16552d43ece 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1500,6 +1500,17 @@ sal_Int32 ZipFile::readCEN() SAL_INFO("package", "Duplicate CEN entry: \"" << aEntry.sPath << "\""); throw ZipException(u"Duplicate CEN entry"_ustr); } + if (aEntries.empty() && m_Checks == Checks::TryCheckInsensitive) + { + if (aEntry.sPath == "mimetype" && aEntry.nSize == 0) + { // tdf#162866 AutoCorrect uses ODF package, directories are + m_Checks = Checks::Default; // user-defined => ignore! + } + else + { + m_Checks = Checks::CheckInsensitive; + } + } // this is required for OOXML, but not for ODF auto const lowerPath(aEntry.sPath.toAsciiLowerCase()); if (!m_EntriesInsensitive.insert(lowerPath).second && m_Checks == Checks::CheckInsensitive) diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index a5dcc5b76e6b..85efe2003149 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -896,7 +896,11 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) { m_pZipFile.emplace(m_aMutexHolder, m_xContentStream, m_xContext, true, m_bForceRecovery, - m_nFormat == embed::StorageFormats::ZIP ? ZipFile::Checks::Default : ZipFile::Checks::CheckInsensitive); + m_nFormat == embed::StorageFormats::ZIP + ? ZipFile::Checks::Default + : m_nFormat == embed::StorageFormats::OFOPXML + ? ZipFile::Checks::CheckInsensitive + : ZipFile::Checks::TryCheckInsensitive); getZipFileContents(); } catch ( IOException & e ) @@ -1270,7 +1274,11 @@ void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream else m_pZipFile.emplace(m_aMutexHolder, m_xContentStream, m_xContext, false, false, - m_nFormat == embed::StorageFormats::ZIP ? ZipFile::Checks::Default : ZipFile::Checks::CheckInsensitive); + m_nFormat == embed::StorageFormats::ZIP + ? ZipFile::Checks::Default + : m_nFormat == embed::StorageFormats::OFOPXML + ? ZipFile::Checks::CheckInsensitive + : ZipFile::Checks::TryCheckInsensitive); } uno::Reference< io::XInputStream > ZipPackage::writeTempFile() |