From: Aaron Schulz Date: Tue, 22 Apr 2014 02:30:44 +0000 (-0700) Subject: Avoid bogus IE extension check errors in img_auth.php X-Git-Tag: 1.31.0-rc.0~16078^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a650998aa75c617bd2042ccd1b56737dc4517d08;p=lhc%2Fweb%2Fwiklou.git Avoid bogus IE extension check errors in img_auth.php Change-Id: I57083d3fe0517b94d3b786970b412e6ec51cf5f0 --- diff --git a/img_auth.php b/img_auth.php index dc3dcd8f6d..3b8cc91fcc 100644 --- a/img_auth.php +++ b/img_auth.php @@ -78,7 +78,7 @@ function wfImageAuthMain() { // Check for bug 28235: QUERY_STRING overriding the correct extension $whitelist = array(); - $extension = FileBackend::extensionFromPath( $path ); + $extension = FileBackend::extensionFromPath( $path, 'rawcase' ); if ( $extension != '' ) { $whitelist[] = $extension; } diff --git a/includes/filebackend/FileBackend.php b/includes/filebackend/FileBackend.php index 7156fba066..f99da6dbc7 100644 --- a/includes/filebackend/FileBackend.php +++ b/includes/filebackend/FileBackend.php @@ -1402,12 +1402,20 @@ abstract class FileBackend { * Get the final extension from a storage or FS path * * @param string $path + * @param string $case One of (rawcase, uppercase, lowercase) (since 1.24) * @return string */ - final public static function extensionFromPath( $path ) { + final public static function extensionFromPath( $path, $case = 'lowercase' ) { $i = strrpos( $path, '.' ); + $ext = $i ? substr( $path, $i + 1 ) : ''; - return strtolower( $i ? substr( $path, $i + 1 ) : '' ); + if ( $case === 'lowercase' ) { + $ext = strtolower( $ext ); + } elseif ( $case === 'uppercase' ) { + $ext = strtoupper( $ext ); + } + + return $ext; } /**