WordPress.org

Make WordPress Core

Ticket #22532: 22532.patch

File 22532.patch, 830 bytes (added by SergeyBiryukov, 20 months ago)
  • wp-includes/media.php

     
    12351235 */ 
    12361236function wp_prepare_attachment_for_js( $attachment ) { 
    12371237        if ( ! $attachment = get_post( $attachment ) ) 
    1238            return; 
     1238                return; 
    12391239 
    12401240        if ( 'attachment' != $attachment->post_type ) 
    1241            return; 
     1241                return; 
    12421242 
    12431243        $meta = wp_get_attachment_metadata( $attachment->ID ); 
    1244         list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); 
     1244        if ( false !== strpos( $attachment->post_mime_type, '/' ) ) 
     1245                list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); 
     1246        else 
     1247                list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); 
    12451248 
    12461249        $attachment_url = wp_get_attachment_url( $attachment->ID ); 
    12471250