Tim Starling has submitted this change and it was merged.
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(-)
Approvals:
Tim Starling: Verified; Looks good to me, approved
diff --git a/includes/filebackend/FileBackendStore.php
b/includes/filebackend/FileBackendStore.php
index 8b280e0..46ec177 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -1417,7 +1417,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()
*
@@ -1426,7 +1432,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: merged
Gerrit-Change-Id: I162ca34fe9f92d862345004bd184013531da9e8d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits