From: Thiemo Kreuz Date: Wed, 2 Jan 2019 15:27:09 +0000 (+0100) Subject: filerepo: Avoid two pointless substr() in File X-Git-Tag: 1.34.0-rc.0~3159^2~1 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=0aedb4d5e0597ec915026ec586ad141434324987;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;