From 8ac7d042292e6f366c91785dc29870ba92fa858a Mon Sep 17 00:00:00 2001 From: subhanigc Date: Sun, 26 Apr 2026 12:06:05 +0500 Subject: [PATCH] tdf#171853 use endsWith instead of lastIndexOf+getLength in comphelper Change-Id: I8e18fab55e86d912673698b284ddc89b59342bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204354 Reviewed-by: Neil Roberts Tested-by: Jenkins --- comphelper/source/misc/documentinfo.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/comphelper/source/misc/documentinfo.cxx b/comphelper/source/misc/documentinfo.cxx index 21425524e64e..2854ed1f0791 100644 --- a/comphelper/source/misc/documentinfo.cxx +++ b/comphelper/source/misc/documentinfo.cxx @@ -120,12 +120,8 @@ namespace comphelper { Reference< XStorable > xDocStorable( _rxDocument, UNO_QUERY_THROW ); sDocURL = xDocStorable->getLocation(); } + sDocURL.endsWith(u"/", &sDocURL); sal_Int32 nLastSepPos = sDocURL.lastIndexOf( '/' ); - if ( ( nLastSepPos != -1 ) && ( nLastSepPos == sDocURL.getLength() - 1 ) ) - { - sDocURL = sDocURL.copy( 0, nLastSepPos ); - nLastSepPos = sDocURL.lastIndexOf( '/' ); - } sTitle = sDocURL.copy( nLastSepPos + 1 ); if ( !sTitle.isEmpty() )