mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Handle attachments that have an empty mime type or a mime type without a subtype.
Props SergeyBiryukov fixes #22532 git-svn-id: http://core.svn.wordpress.org/trunk@22830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc58c611ec
commit
7a0852c31c
@ -1294,13 +1294,16 @@ add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings'
|
|||||||
*/
|
*/
|
||||||
function wp_prepare_attachment_for_js( $attachment ) {
|
function wp_prepare_attachment_for_js( $attachment ) {
|
||||||
if ( ! $attachment = get_post( $attachment ) )
|
if ( ! $attachment = get_post( $attachment ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( 'attachment' != $attachment->post_type )
|
if ( 'attachment' != $attachment->post_type )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$meta = wp_get_attachment_metadata( $attachment->ID );
|
$meta = wp_get_attachment_metadata( $attachment->ID );
|
||||||
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
|
if ( false !== strpos( $attachment->post_mime_type, '/' ) )
|
||||||
|
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
|
||||||
|
else
|
||||||
|
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
|
||||||
|
|
||||||
$attachment_url = wp_get_attachment_url( $attachment->ID );
|
$attachment_url = wp_get_attachment_url( $attachment->ID );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user