Skip to content

Commit

Permalink
When deleting, make sure we're not deleting a fallback template
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Dec 21, 2021
1 parent 232f3ba commit 275cc3c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function delete_item_permissions_check( $request ) {
*/
public function delete_item( $request ) {
$template = gutenberg_get_block_template( $request['id'], $this->post_type );
if ( ! $template ) {
if ( ! $template || $template->id !== $request['id'] ) { // Make sure there is a template for this ID (and not just a fallback one).
return new WP_Error( 'rest_template_not_found', __( 'No templates exist with that id.', 'gutenberg' ), array( 'status' => 404 ) );
}
if ( 'custom' !== $template->source ) {
Expand Down

0 comments on commit 275cc3c

Please sign in to comment.