diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
commit | 5a7157d319477830426797532e02ac39d3b859f4 (patch) | |
tree | 3773f5ce209bee14a5643e98672e0f3828c71434 /package/source/zippackage/ZipPackage.cxx | |
parent | Releasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff) | |
download | libreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 02f7cf71e8..0f3fa6ff7d 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -171,6 +171,7 @@ void ZipPackage::parseManifest() return; bool bManifestParsed = false; + ::std::optional<OUString> oFirstVersion; static constexpr OUString sMeta (u"META-INF"_ustr); if ( m_xRootFolder->hasByName( sMeta ) ) { @@ -216,7 +217,13 @@ void ZipPackage::parseManifest() if ( rValue.Name == sPropFullPath ) rValue.Value >>= sPath; else if ( rValue.Name == sPropVersion ) + { rValue.Value >>= sVersion; + if (!oFirstVersion) + { + oFirstVersion.emplace(sVersion); + } + } else if ( rValue.Name == sPropMediaType ) rValue.Value >>= sMediaType; else if ( rValue.Name == sPropSalt ) @@ -457,6 +464,11 @@ void ZipPackage::parseManifest() { // accept only types that look similar to own mediatypes m_xRootFolder->SetMediaType( aPackageMediatype ); + // also set version explicitly + if (oFirstVersion && m_xRootFolder->GetVersion().isEmpty()) + { + m_xRootFolder->SetVersion(*oFirstVersion); + } // if there is an encrypted inner package, there is no root // document, because instead there is a package, and it is not // an error @@ -1716,6 +1728,11 @@ uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey() for ( const auto& rKey : std::as_const(m_aStorageEncryptionKeys) ) if ( rKey.Name == aNameToFind ) rKey.Value >>= aResult; + + if (!aResult.hasElements() && m_aStorageEncryptionKeys.hasElements()) + { // tdf#159519 sanity check + throw uno::RuntimeException(THROW_WHERE "Expected key is missing!"); + } } else aResult = m_aEncryptionKey; |