Skip to content

Commit 4dbb3e7

Browse files
Handle an empty value for $output_mime_types: only output the original type.
1 parent 1589bfd commit 4dbb3e7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/wp-admin/includes/image.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,11 @@ function( $mime_type ) {
13871387
}
13881388
);
13891389

1390+
// Handle an empty value for $output_mime_types: only output the original type.
1391+
if ( empty( $output_mime_types ) ) {
1392+
return array( $original_mime_type, array() );
1393+
}
1394+
13901395
// Use original mime type as primary mime type, or alternatively the first one.
13911396
$primary_mime_type_key = array_search( $original_mime_type, $output_mime_types, true );
13921397
if ( false === $primary_mime_type_key ) {
@@ -1396,10 +1401,6 @@ function( $mime_type ) {
13961401
$additional_mime_types = $output_mime_types;
13971402
list( $primary_mime_type ) = array_splice( $additional_mime_types, $primary_mime_type_key, 1 );
13981403

1399-
// Ensure $primary_mime_type is set.
1400-
if ( empty( $primary_mime_type ) ) {
1401-
$primary_mime_type = $original_mime_type;
1402-
}
14031404
return array(
14041405
$primary_mime_type,
14051406
$additional_mime_types,

0 commit comments

Comments
 (0)