tdf#171853 Replace lastIndexOf by endsWith in pkgcontent.cxx

Change-Id: I9b1e840af20b80a946b7a79f141e505cc7aa4838
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209441
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
ApurvR20
2026-08-21 12:21:07 +02:00
committed by Ilmari Lauhakangas
parent 1bc7372569
commit ccba2e008f
+4 -6
View File
@@ -160,8 +160,7 @@ rtl::Reference<Content> Content::create(
{
// resource exists
sal_Int32 nLastSlash = aURL.lastIndexOf( '/' );
if ( ( nLastSlash + 1 ) == aURL.getLength() )
if ( aURL.endsWith('/') )
{
// Client explicitly requested a folder!
if ( !aProps.bIsFolder )
@@ -179,8 +178,7 @@ rtl::Reference<Content> Content::create(
bool bFolder = false;
// Guess type according to URI.
sal_Int32 nLastSlash = aURL.lastIndexOf( '/' );
if ( ( nLastSlash + 1 ) == aURL.getLength() )
if ( aURL.endsWith('/') )
bFolder = true;
uno::Reference< ucb::XContentIdentifier > xId
@@ -1504,7 +1502,7 @@ void Content::insert(
}
OUString aNewURL = m_aUri.getParentUri();
if (1 + aNewURL.lastIndexOf('/') != aNewURL.getLength())
if (!aNewURL.endsWith('/'))
aNewURL += "/";
aNewURL += ::ucb_impl::urihelper::encodeSegment( m_aProps.aTitle );
PackageUri aNewUri( aNewURL );
@@ -2015,7 +2013,7 @@ void Content::queryChildren( ContentRefList& rChildren )
OUString aURL = m_xIdentifier->getContentIdentifier();
OSL_ENSURE( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ),
OSL_ENSURE( !aURL.endsWith('/'),
"Content::queryChildren - Invalid URL!" );
aURL += "/";