tdf#171853 Use endsWith instead of checking lastIndexOf at string in fpicker

Change-Id: Idb8ffafa585bdb032ddb9c187b29eb5fb0a3f45d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209462
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Marios
2026-09-22 09:14:53 +02:00
committed by Neil Roberts
parent a71586f77b
commit 3f568ed6c4
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -1065,8 +1065,8 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL )
{
//WebDAV folders path ends in '/', so strip it
OUString aFolderName = rFolder.maURL;
if( rFolder.mbIsFolder && ( ( aFolderName.lastIndexOf( '/' ) + 1 ) == aFolderName.getLength() ) )
aFolderName = aFolderName.copy( 0, aFolderName.getLength() - 1 );
if ( rFolder.mbIsFolder )
aFolderName.endsWith('/', &aFolderName);
int nTitleStart = aFolderName.lastIndexOf( '/' );
if( nTitleStart != -1 )
+1 -2
View File
@@ -895,8 +895,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(Request& rRequest)
if (m_sFilename.getLength())
{
OUString aFileURL(m_sDirectory);
sal_Int32 nIndex = aFileURL.lastIndexOf('/');
if (nIndex != aFileURL.getLength()-1)
if (!aFileURL.endsWith('/'))
aFileURL += "/";
aFileURL += m_sFilename;