From: Aaron Schulz Date: Thu, 4 Apr 2013 23:50:51 +0000 (-0700) Subject: [FileBackend] Disallow files ending in / and clarified some docs. X-Git-Tag: 1.31.0-rc.0~19943 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=14fc5f5a937bda3b1cb3ba6a450359d723440283;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Disallow files ending in / and clarified some docs. Change-Id: I162ca34fe9f92d862345004bd184013531da9e8d --- diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 8b280e0bb0..46ec177965 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -1417,7 +1417,13 @@ abstract class FileBackendStore extends FileBackend { /** * 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() * @@ -1426,7 +1432,7 @@ abstract class FileBackendStore extends FileBackend { */ 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 );