From 0aedb4d5e0597ec915026ec586ad141434324987 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 2 Jan 2019 16:27:09 +0100 Subject: [PATCH] filerepo: Avoid two pointless substr() in File In both cases the slash was added one line above, just to be cut off again. Change-Id: I15ff6b47821033f123f555f02c42fc8984ad9800 --- includes/filerepo/file/File.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index cc39b94475..76bdba4b41 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1586,11 +1586,9 @@ abstract class File implements IDBAccessObject { * @return string */ function getArchiveThumbRel( $archiveName, $suffix = false ) { - $path = $this->getArchiveRel( $archiveName ) . "/"; - if ( $suffix === false ) { - $path = substr( $path, 0, -1 ); - } else { - $path .= $suffix; + $path = $this->getArchiveRel( $archiveName ); + if ( $suffix !== false ) { + $path .= '/' . $suffix; } return $path; @@ -1676,11 +1674,9 @@ abstract class File implements IDBAccessObject { $this->assertRepoDefined(); $ext = $this->getExtension(); $path = $this->repo->getZoneUrl( 'thumb', $ext ) . '/archive/' . - $this->getHashPath() . rawurlencode( $archiveName ) . "/"; - if ( $suffix === false ) { - $path = substr( $path, 0, -1 ); - } else { - $path .= rawurlencode( $suffix ); + $this->getHashPath() . rawurlencode( $archiveName ); + if ( $suffix !== false ) { + $path .= '/' . rawurlencode( $suffix ); } return $path; -- 2.20.1