diff --git a/classes/Optimization/File.php b/classes/Optimization/File.php index 6173b204..7c2fb181 100644 --- a/classes/Optimization/File.php +++ b/classes/Optimization/File.php @@ -745,10 +745,9 @@ public function get_mime_type() { /** * Get the file extension. * - * @since 1.9 - * @author Grégory Viguier + * @since 1.9 * - * @return string|null + * @return string|false */ public function get_extension() { return $this->get_file_type()->ext; diff --git a/classes/Optimization/Process/AbstractProcess.php b/classes/Optimization/Process/AbstractProcess.php index 15b4358b..bbe47b48 100644 --- a/classes/Optimization/Process/AbstractProcess.php +++ b/classes/Optimization/Process/AbstractProcess.php @@ -581,7 +581,12 @@ public function optimize_size( $size, $optimization_level = null ) { // This file type is not supported. $extension = $file->get_extension(); - if ( '' === $extension ) { + if ( ! $extension ) { + $response = new WP_Error( + 'extension_not_mime', + __( 'This file has an extension that does not match a mime type.', 'imagify' ) + ); + } elseif ( '' === $extension ) { $response = new WP_Error( 'no_extension', __( 'With no extension, this file cannot be optimized.', 'imagify' )