[FileBackend] Added UTF-8 restriction to file names to avoid CF breakage.
authorAaron <aschulz@wikimedia.org>
Fri, 10 Aug 2012 21:25:59 +0000 (14:25 -0700)
committerAaron <aschulz@wikimedia.org>
Fri, 10 Aug 2012 21:25:59 +0000 (14:25 -0700)
Change-Id: Id0f246c80f2595fba96e99b3bbe778e89dbc6e84

includes/filebackend/SwiftFileBackend.php

index 5be86e6..5fe568a 100644 (file)
@@ -116,7 +116,9 @@ class SwiftFileBackend extends FileBackendStore {
         * @return null
         */
        protected function resolveContainerPath( $container, $relStoragePath ) {
-               if ( strlen( urlencode( $relStoragePath ) ) > 1024 ) {
+               if ( !mb_check_encoding( $relStoragePath, 'UTF-8' ) ) { // mb_string required by CF
+                       return null; // not UTF-8, makes it hard to use CF and the swift HTTP API
+               } elseif ( strlen( urlencode( $relStoragePath ) ) > 1024 ) {
                        return null; // too long for Swift
                }
                return $relStoragePath;