This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new bd3f92fa71 Some 3rd party applications write OOXML files whose ZIP 
entries have filenames in different casing than their XML files specify, eg. 
sharedStrings.xml is actually stored in the ZIP file as SharedStrings.xml. 
Thus, when we can't find files with their intended casing, do a 
case-insensitive search within their ZIP directory instead.
bd3f92fa71 is described below

commit bd3f92fa7151c22b06c065512cbefd13960d9f7c
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Fri Jan 6 11:57:30 2023 +0200

    Some 3rd party applications write OOXML files whose ZIP entries have 
filenames in
    different casing than their XML files specify, eg. sharedStrings.xml is 
actually
    stored in the ZIP file as SharedStrings.xml. Thus, when we can't find files 
with
    their intended casing, do a case-insensitive search within their ZIP 
directory
    instead.
    
    Fixes: https://bz.apache.org/ooo/show_bug.cgi?id=126720 - no text imported 
from xlsx
    Patch by: me
    
    (cherry picked from commit 0f42b9a04e21324973f03349bb2929327cf84a20)
---
 main/oox/source/helper/zipstorage.cxx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/main/oox/source/helper/zipstorage.cxx 
b/main/oox/source/helper/zipstorage.cxx
index 2e35e5fa11..afc8e757f3 100644
--- a/main/oox/source/helper/zipstorage.cxx
+++ b/main/oox/source/helper/zipstorage.cxx
@@ -172,6 +172,23 @@ Reference< XInputStream > ZipStorage::implOpenInputStream( 
const OUString& rElem
     }
     catch( Exception& )
     {
+        // Bug 126720 - sometimes the relationship says the file is 
"sharedStrings.xml" but the file is actually "SharedStrings.xml".
+        // Do a case-insensitive search:
+        ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = 
mxStorage->getElementNames( );
+        for ( sal_Int32 i = 0; i < aNames.getLength(); i++ )
+        {
+            if ( aNames[i].equalsIgnoreAsciiCase( rElementName ) )
+            {
+                try
+                {
+                    xInStream.set( mxStorage->openStreamElement( aNames[i], 
::com::sun::star::embed::ElementModes::READ ), UNO_QUERY );
+                }
+                catch( Exception& )
+                {
+                }
+                break;
+            }
+        }
     }
     return xInStream;
 }

Reply via email to