From: Aaron Date: Fri, 10 Aug 2012 21:25:59 +0000 (-0700) Subject: [FileBackend] Added UTF-8 restriction to file names to avoid CF breakage. X-Git-Tag: 1.31.0-rc.0~22773 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=9803fd6b2eaa852005e07d4c56de1fc27deec973;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Added UTF-8 restriction to file names to avoid CF breakage. Change-Id: Id0f246c80f2595fba96e99b3bbe778e89dbc6e84 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 5be86e6807..5fe568a2c9 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -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;