Media: skip server image support check when using client-side media.
When uploading images via the REST API with `generate_sub_sizes` set to `false`, skip server support checks since processing is handled on the client side. Fix an issue where uploads of formats like AVIF fail with `rest_upload_image_type_not_supported`, even though the client will handle all image processing and the server doesn't need to support the format. See also https://github.com/WordPress/gutenberg/issues/76369 and https://github.com/WordPress/gutenberg/pull/76371. Props adamsilverstein, westonruter, andrewserong, mukesh27. Fixes #64836. See #62717. Built from https://develop.svn.wordpress.org/trunk@61980 git-svn-id: http://core.svn.wordpress.org/trunk@61262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -232,6 +232,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
*/
|
||||
$prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, $files['file']['type'] ?? null );
|
||||
|
||||
// When the client handles image processing (generate_sub_sizes is false),
|
||||
// skip the server-side image editor support check.
|
||||
if ( false === $request['generate_sub_sizes'] ) {
|
||||
$prevent_unsupported_uploads = false;
|
||||
}
|
||||
|
||||
// If the upload is an image, check if the server can handle the mime type.
|
||||
if (
|
||||
$prevent_unsupported_uploads &&
|
||||
@@ -278,7 +284,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
}
|
||||
|
||||
// Handle generate_sub_sizes parameter.
|
||||
if ( isset( $request['generate_sub_sizes'] ) && ! $request['generate_sub_sizes'] ) {
|
||||
if ( false === $request['generate_sub_sizes'] ) {
|
||||
add_filter( 'intermediate_image_sizes_advanced', '__return_empty_array', 100 );
|
||||
add_filter( 'fallback_intermediate_image_sizes', '__return_empty_array', 100 );
|
||||
// Disable server-side EXIF rotation so the client can handle it.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-beta4-61979';
|
||||
$wp_version = '7.0-beta4-61980';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user