package/source/xstor/xstorage.cxx |    6 ++++++
 package/source/xstor/xstorage.hxx |    1 +
 2 files changed, 7 insertions(+)

New commits:
commit df6a8667e6dd8b710bfae4944915f6eeb4efb233
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Dec 14 12:56:03 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Dec 14 15:21:35 2023 +0100

    tdf#131575: in repair mode, match names ASCII case-insensitively
    
    It would work for the bugdoc in tdf#131575; but not if the wrong case
    is the only problem in the package, because then there would be no
    repairment mode active. An alternative could be to use case insensitive
    match always, but that looks wrong.
    
    Change-Id: Ie405d37e1dc639482bd2608e4479de5b707a07d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160761
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/package/source/xstor/xstorage.cxx 
b/package/source/xstor/xstorage.cxx
index 05150a48f988..d19d1cac7f33 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -403,6 +403,8 @@ void OStorage_Impl::OpenOwnPackage()
                     aArguments.realloc( ++nArgNum );
                     pArguments = aArguments.getArray();
                     pArguments[nArgNum-1] <<= aNamedValue;
+                    if (rProp.Name == "RepairPackage")
+                        rProp.Value >>= m_bRepairPackage;
                 }
                 else if ( rProp.Name == "Password" )
                 {
@@ -1264,6 +1266,10 @@ SotElement_Impl* OStorage_Impl::FindElement( const 
OUString& rName )
     ReadContents();
 
     auto mapIt = m_aChildrenMap.find(rName);
+    if (mapIt == m_aChildrenMap.end() && m_bRepairPackage)
+        mapIt = std::find_if(m_aChildrenMap.begin(), m_aChildrenMap.end(),
+                             [&rName](const auto& pair)
+                             { return rName.equalsIgnoreAsciiCase(pair.first); 
});
     if (mapIt == m_aChildrenMap.end())
         return nullptr;
     for (auto pElement : mapIt->second)
diff --git a/package/source/xstor/xstorage.hxx 
b/package/source/xstor/xstorage.hxx
index a32aeca1d25d..54fe49a9d9ca 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -122,6 +122,7 @@ struct OStorage_Impl
 
     bool                        m_bIsRoot;      // marks this storage as root 
storages that manages all commits and reverts
     bool                        m_bListCreated;
+    bool                        m_bRepairPackage = false;
 
     /// Count of registered modification listeners
     oslInterlockedCount         m_nModifiedListenerCount;

Reply via email to