Make WordPress Core

Changeset 22830


Ignore:
Timestamp:
11/23/2012 04:32:21 PM (12 years ago)
Author:
ryan
Message:

Handle attachments that have an empty mime type or a mime type without a subtype.

Props SergeyBiryukov
fixes #22532

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r22825 r22830  
    12951295function wp_prepare_attachment_for_js( $attachment ) {
    12961296    if ( ! $attachment = get_post( $attachment ) )
    1297        return;
     1297        return;
    12981298
    12991299    if ( 'attachment' != $attachment->post_type )
    1300        return;
     1300        return;
    13011301
    13021302    $meta = wp_get_attachment_metadata( $attachment->ID );
    1303     list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
     1303    if ( false !== strpos( $attachment->post_mime_type, '/' ) )
     1304        list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
     1305    else
     1306        list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
    13041307
    13051308    $attachment_url = wp_get_attachment_url( $attachment->ID );
Note: See TracChangeset for help on using the changeset viewer.