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:
Ryan Boren 2012-11-23 16:32:21 +00:00
parent cc58c611ec
commit 7a0852c31c
1 changed files with 6 additions and 3 deletions

View File

@ -1300,7 +1300,10 @@ function wp_prepare_attachment_for_js( $attachment ) {
return;
$meta = wp_get_attachment_metadata( $attachment->ID );
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 );