Kaydet (Commit) e8504d97 authored tarafından Gergő Mocsi's avatar Gergő Mocsi Kaydeden (comit) Andras Timar

handle the empty URL case in file picker

Some extensions in the wild, for example Impress Photo Album Creator,
manage to call the file picker dialog with an empty URL. The resulting
error message is not very helpful: "Operation not supported" dialog.
Therefore we assign a default URL when empty URL is passed.

Change-Id: Icf71142411a79e1fe2d1d5918d2a400b174acc00
Reviewed-on: https://gerrit.libreoffice.org/2390Reviewed-by: 's avatarAndras Timar <atimar@suse.com>
Tested-by: 's avatarAndras Timar <atimar@suse.com>
üst e76e2c4c
...@@ -78,6 +78,9 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir ...@@ -78,6 +78,9 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir
OSL_ASSERT( m_pDialog != NULL ); OSL_ASSERT( m_pDialog != NULL );
OString aTxt = unicodetouri( aDirectory ); OString aTxt = unicodetouri( aDirectory );
if( aTxt.isEmpty() ){
aTxt = unicodetouri(OUString("file:///."));
}
if( !aTxt.isEmpty() && aTxt.lastIndexOf('/') == aTxt.getLength() - 1 ) if( !aTxt.isEmpty() && aTxt.lastIndexOf('/') == aTxt.getLength() - 1 )
aTxt = aTxt.copy( 0, aTxt.getLength() - 1 ); aTxt = aTxt.copy( 0, aTxt.getLength() - 1 );
......
...@@ -217,6 +217,9 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec ...@@ -217,6 +217,9 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec
OSL_ASSERT( m_pDialog != NULL ); OSL_ASSERT( m_pDialog != NULL );
OString aTxt = unicodetouri(aDirectory); OString aTxt = unicodetouri(aDirectory);
if( aTxt.isEmpty() ){
aTxt = unicodetouri(OUString("file:///."));
}
if( aTxt.lastIndexOf('/') == aTxt.getLength() - 1 ) if( aTxt.lastIndexOf('/') == aTxt.getLength() - 1 )
aTxt = aTxt.copy( 0, aTxt.getLength() - 1 ); aTxt = aTxt.copy( 0, aTxt.getLength() - 1 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment