Skip to content

Commit 670b63f

Browse files
committed
Remove unnecessary checks for whether existing image files are within the allowed image transformations.
1 parent 95d1fc0 commit 670b63f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

modules/images/webp-uploads/load.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ function webp_uploads_create_sources_property( array $metadata, $attachment_id )
5555
$metadata['sources'] = array();
5656
}
5757

58-
if (
59-
empty( $metadata['sources'][ $mime_type ] ) &&
60-
in_array( $mime_type, $valid_mime_transforms[ $mime_type ], true )
61-
) {
58+
if ( empty( $metadata['sources'][ $mime_type ] ) ) {
6259
$metadata['sources'][ $mime_type ] = array(
6360
'file' => wp_basename( $file ),
6461
'filesize' => wp_filesize( $file ),
@@ -137,12 +134,9 @@ function webp_uploads_create_sources_property( array $metadata, $attachment_id )
137134
$properties['sources'] = array();
138135
}
139136

140-
if (
141-
in_array( $current_mime, $valid_mime_transforms[ $mime_type ], true ) &&
142-
empty( $properties['sources'][ $current_mime ] )
143-
) {
137+
if ( empty( $properties['sources'][ $current_mime ] ) && isset( $properties['file'] ) ) {
144138
$properties['sources'][ $current_mime ] = array(
145-
'file' => isset( $properties['file'] ) ? $properties['file'] : '',
139+
'file' => $properties['file'],
146140
'filesize' => 0,
147141
);
148142
// Set the filesize from the current mime image.

0 commit comments

Comments
 (0)