Making WordPress.org

Changeset 12133


Ignore:
Timestamp:
10/19/2022 02:47:56 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Blocks Import: Ignore invalid blocks that don't specify a name or other required fields.

The error codes now read name is a required property of block.json. which doesn't contain block.json[name].
This seems like it may have been broken since the schema-source change in [11410].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r11410 r12133  
    806806                    $required_valid_props,
    807807                    function( $is_valid, $prop ) use ( $error ) {
    808                         return $is_valid && ( false === strpos( $error, $prop ) );
     808                        $prop_field = substr( $prop, 11, -1 ); // 'name' in 'block.json[name]'
     809                        return (
     810                            $is_valid &&
     811                            ( false === strpos( $error, $prop ) ) &&
     812                            // String in rest_validate_object_value_from_schema()
     813                            ( false === strpos( $error, "{$prop_field} is a required property of block.json." ) )
     814                        );
    809815                    },
    810816                    true
Note: See TracChangeset for help on using the changeset viewer.