Ensure we don't generate incorrect content types when files are requested with query strings. props chrisbliss18. fixes #14450 for the 3.0 branch.

git-svn-id: http://svn.automattic.com/wordpress/branches/3.0@16632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-30 20:44:08 +00:00
parent f06897b0f4
commit 7fea15206a
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' ) )