$path = $matches['title'];
// Check for bug 28235: QUERY_STRING overriding the correct extension
-$dotPos = strpos( $path, '.' );
+$dotPos = strrpos( $path, '.' );
$whitelist = array();
if ( $dotPos !== false ) {
$whitelist[] = substr( $path, $dotPos + 1 );