Merge "filerepo: Replace confusing substr() with rtrim()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 2 Jan 2019 21:22:49 +0000 (21:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 2 Jan 2019 21:22:49 +0000 (21:22 +0000)
includes/filerepo/file/File.php

index 76bdba4..923484a 100644 (file)
@@ -1543,7 +1543,7 @@ abstract class File implements IDBAccessObject {
        function getArchiveRel( $suffix = false ) {
                $path = 'archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= $suffix;
                }
@@ -1655,7 +1655,7 @@ abstract class File implements IDBAccessObject {
                $ext = $this->getExtension();
                $path = $this->repo->getZoneUrl( 'public', $ext ) . '/archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= rawurlencode( $suffix );
                }
@@ -1746,7 +1746,7 @@ abstract class File implements IDBAccessObject {
                $this->assertRepoDefined();
                $path = $this->repo->getVirtualUrl() . '/public/archive/' . $this->getHashPath();
                if ( $suffix === false ) {
-                       $path = substr( $path, 0, -1 );
+                       $path = rtrim( $path, '/' );
                } else {
                        $path .= rawurlencode( $suffix );
                }