Ensure we don't generate incorrect content types when files are requested with query strings. Fixes #14450 props chrisbliss18.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-10-07 21:00:45 +00:00
parent 528ada2699
commit 7e5c6cb031
1 changed files with 2 additions and 2 deletions

View File

@ -29,14 +29,14 @@ if ( !is_file( $file ) ) {
die( '404 — File not found.' );
}
$mime = wp_check_filetype( $_SERVER[ 'REQUEST_URI' ] );
$mime = wp_check_filetype( $file );
if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
$mime[ 'type' ] = mime_content_type( $file );
if( $mime[ 'type' ] )
$mimetype = $mime[ 'type' ];
else
$mimetype = 'image/' . substr( $_SERVER[ 'REQUEST_URI' ], strrpos( $_SERVER[ 'REQUEST_URI' ], '.' ) + 1 );
$mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
header( 'Content-type: ' . $mimetype ); // always send this
if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )