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 //WebDAV folders path ends in '/', so strip it
OUString aFolderName = rFolder.maURL; OUString aFolderName = rFolder.maURL;
if( rFolder.mbIsFolder && ( ( aFolderName.lastIndexOf( '/' ) + 1 ) == aFolderName.getLength() ) ) if ( rFolder.mbIsFolder )
aFolderName = aFolderName.copy( 0, aFolderName.getLength() - 1 ); aFolderName.endsWith('/', &aFolderName);
int nTitleStart = aFolderName.lastIndexOf( '/' ); int nTitleStart = aFolderName.lastIndexOf( '/' );
if( nTitleStart != -1 ) if( nTitleStart != -1 )
+1 -2
View File
@@ -895,8 +895,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(Request& rRequest)
if (m_sFilename.getLength()) if (m_sFilename.getLength())
{ {
OUString aFileURL(m_sDirectory); OUString aFileURL(m_sDirectory);
sal_Int32 nIndex = aFileURL.lastIndexOf('/'); if (!aFileURL.endsWith('/'))
if (nIndex != aFileURL.getLength()-1)
aFileURL += "/"; aFileURL += "/";
aFileURL += m_sFilename; aFileURL += m_sFilename;