You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2023/01/07 17:20:02 UTC

[openoffice] branch AOO41X updated: 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.

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

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


The following commit(s) were added to refs/heads/AOO41X by this push:
     new 25c6f4b735 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.
25c6f4b735 is described below

commit 25c6f4b735608c9ccf2d582718536ff7c9470ddd
Author: Damjan Jovanovic <da...@apache.org>
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;
 }