Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/57685


Change subject: [FileBackend] Disallow files ending in / and clarified some 
docs.
......................................................................

[FileBackend] Disallow files ending in / and clarified some docs.

Change-Id: I162ca34fe9f92d862345004bd184013531da9e8d
---
M includes/filebackend/FileBackendStore.php
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/85/57685/1

diff --git a/includes/filebackend/FileBackendStore.php 
b/includes/filebackend/FileBackendStore.php
index 1356ebe..9083d38 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -1413,7 +1413,13 @@
 
        /**
         * Like resolveStoragePath() except null values are returned if
-        * the container is sharded and the shard could not be determined.
+        * the container is sharded and the shard could not be determined
+        * or if the path ends with '/'. The later case is illegal for FS
+        * backends and can confuse listings for object store backends.
+        *
+        * This function is used when resolving paths that must be valid
+        * locations for files. Directory and listing functions should
+        * generally just use resolveStoragePath() instead.
         *
         * @see FileBackendStore::resolveStoragePath()
         *
@@ -1422,7 +1428,7 @@
         */
        final protected function resolveStoragePathReal( $storagePath ) {
                list( $container, $relPath, $cShard ) = 
$this->resolveStoragePath( $storagePath );
-               if ( $cShard !== null ) {
+               if ( $cShard !== null && substr( $relPath, -1 ) !== '/' ) {
                        return array( $container, $relPath );
                }
                return array( null, null );

-- 
To view, visit https://gerrit.wikimedia.org/r/57685
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I162ca34fe9f92d862345004bd184013531da9e8d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to