[FileBackend] Added UTF-8 restriction to file names to avoid CF breakage.
[lhc/web/wiklou.git] / 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;