WordPress.org

Make WordPress Core

Ticket #16458: 16458.3.diff

File 16458.3.diff, 696 bytes (added by SergeyBiryukov, 6 years ago)
  • wp-includes/media.php

     
    462462                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
    463463        } else {
    464464                // all other formats are converted to jpg
    465                 $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
     465                if ( 'jpg' != $ext && 'jpeg' != $ext )
     466                        $ext = 'jpg';
     467                $destfilename = "{$dir}/{$name}-{$suffix}.$ext";
    466468                if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
    467469                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
    468470        }