Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54680 closed defect (bug) (fixed)

Site Editor: Adding 404 template causes rest_invalid_pattern

Reported by: bernhard-reiter's profile Bernhard Reiter Owned by: audrasjb's profile audrasjb
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.9
Component: Editor Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

Reported and fixed by GH user @PatelUtkarsh at https://github.com/WordPress/gutenberg/pull/37579.

Quoting the Gutenberg PR:

Adding 404 template from /wp-admin/site-editor.php?postType=wp_template causes 400 with rest_invalid_pattern

  • Theme without 404 templates.
  • Open /wp-admin/site-editor.php?postType=wp_template
  • Add new 404 templates.
  • Used nightly WordPress build to test this.

Screencast: https://user-images.githubusercontent.com/5015489/147066116-2e23ff30-0dd7-45d3-a40a-510ef06156e2.mp4

Change History (12)

This ticket was mentioned in PR #2077 on WordPress/wordpress-develop by ockham.


3 years ago
#1

  • Keywords has-patch added

Backport of https://github.com/WordPress/gutenberg/pull/37579. Props @PatelUtkarsh.

Quoting https://github.com/WordPress/gutenberg/pull/37579:

## Description
Adding 404 template from /wp-admin/site-editor.php?postType=wp_template causes 400 with rest_invalid_pattern

## How has this been tested?

  • Theme without 404 templates.
  • Open /wp-admin/site-editor.php?postType=wp_template
  • Add new 404 templates.
  • Used nightly WordPress build to test this.

## Screenshots
Bug:

https://user-images.githubusercontent.com/5015489/147066116-2e23ff30-0dd7-45d3-a40a-510ef06156e2.mp4

Trac ticket: https://core.trac.wordpress.org/ticket/54680

ockham commented on PR #2077:


3 years ago
#2

cc/ @hellofromtonya @noisysocks @youknowriad -- I think this should go into 5.9 :)

#3 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.9

SergeyBiryukov commented on PR #2077:


3 years ago
#4

Thanks for the PR! This looks good to me. It would also be great to include a unit test for this, some other tests in the phpunit/tests/rest-api/wpRestTemplatesController.php file could be used as a reference.

ockham commented on PR #2077:


3 years ago
#5

Thanks for the PR! This looks good to me. It would also be great to include a unit test for this, some other tests in the phpunit/tests/rest-api/wpRestTemplatesController.php file could be used as a reference.

Sure, happy to add a test!

#6 @hellofromTonya
3 years ago

  • Keywords has-unit-tests commit added

Ready for commit.

ockham commented on PR #2077:


3 years ago
#7

Thanks a lot for reviewing @SergeyBiryukov @rachelbaker @hellofromtonya!

Since I don't have Core commit privileges myself, can I ask one of you kind souls to commit this? 😄

ockham commented on PR #2077:


3 years ago
#8

Thanks a lot for reviewing @SergeyBiryukov @rachelbaker @hellofromtonya!

Since I don't have Core commit privileges myself, can I ask one of you kind souls to commit this? 😄

#9 @audrasjb
3 years ago

  • Owner set to audrasjb
  • Status changed from new to accepted

Self assigning for commit.

#11 @audrasjb
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 52436:

REST API: Add unit tests for the 404 template slug handler.

Props ockham, SergeyBiryukov, hellofromTonya, rachelbaker.
Fixes #54680.

Note: See TracTickets for help on using tickets.