[Libreoffice-commits] core.git: sfx2/source

Eike Rathke erack at redhat.com
Tue Jul 22 11:15:29 PDT 2014


 sfx2/source/doc/guisaveas.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 196abcf8f42891a05ec639a7570e5092bafe1b48
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 22 20:02:36 2014 +0200

    do not unescape sequence in original name in GetRecommendedName()
    
    Noted with the fix for fdo#81304 the code unescaped an escaped sequence
    in the original file name, for example "foo%20bar" became "foo bar".
    This change preserves such sequences, though the final result at the
    (GTK) file picker is still unescaped, which happens somewhere else.
    
    However, now for the suggested file name "foo%20bar#baz" an InetURLObj
    of "foo%2520bar%23baz" is created and results in a recommended name of
    "foo%20bar#baz" again.
    
    Change-Id: I620811e33bdb74323ddcb3d732428179bf7181d4

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 2294772..cf18115 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1279,8 +1279,8 @@ OUString ModelData_Impl::GetRecommendedName( const OUString& aSuggestedName, con
                 uno::UNO_QUERY );
             if ( xTypeDetection.is() )
             {
-                INetURLObject aObj( OUString( "file:///c:/" ) );
-                aObj.SetName( aRecommendedName );
+                INetURLObject aObj( OUString( "c:/" ) + aRecommendedName, INET_PROT_FILE,
+                        INetURLObject::ENCODE_ALL, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DOS );
 
                 uno::Sequence< beans::PropertyValue > aTypeNameProps;
                 if ( ( xTypeDetection->getByName( aTypeName ) >>= aTypeNameProps ) && aTypeNameProps.getLength() )
@@ -1293,7 +1293,7 @@ OUString ModelData_Impl::GetRecommendedName( const OUString& aSuggestedName, con
                         aObj.SetExtension( aExtensions[0] );
                 }
 
-                aRecommendedName = aObj.GetName( INetURLObject::DECODE_WITH_CHARSET );
+                aRecommendedName = aObj.GetName( INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8 );
             }
         }
     }


More information about the Libreoffice-commits mailing list