Ensure we don't generate incorrect content types when files are requested with query strings. Fixes #14450 props chrisbliss18.
git-svn-id: https://develop.svn.wordpress.org/trunk@15749 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7005ab8841
commit
bf878cad07
@ -29,14 +29,14 @@ if ( !is_file( $file ) ) {
|
|||||||
die( '404 — File not found.' );
|
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' ) )
|
if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
|
||||||
$mime[ 'type' ] = mime_content_type( $file );
|
$mime[ 'type' ] = mime_content_type( $file );
|
||||||
|
|
||||||
if( $mime[ 'type' ] )
|
if( $mime[ 'type' ] )
|
||||||
$mimetype = $mime[ 'type' ];
|
$mimetype = $mime[ 'type' ];
|
||||||
else
|
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
|
header( 'Content-type: ' . $mimetype ); // always send this
|
||||||
if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
|
if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user