WordPress.org

Make WordPress Core

Opened 5 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#54680 closed defect (bug) (fixed)

Site Editor: Adding 404 template causes rest_invalid_pattern

Reported by: Bernhard Reiter Owned by: audrasjb
Milestone: 5.9 Priority: normal
Severity: normal Version: trunk
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.


5 weeks ago

  • 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

#2 @prbot
4 weeks ago

ockham commented on PR #2077:

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

#3 @SergeyBiryukov
4 weeks ago

  • Milestone changed from Awaiting Review to 5.9

#4 @prbot
4 weeks ago

SergeyBiryukov commented on PR #2077:

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.

#5 @prbot
3 weeks ago

ockham commented on PR #2077:

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 weeks ago

  • Keywords has-unit-tests commit added

Ready for commit.

#7 @prbot
3 weeks ago

ockham commented on PR #2077:

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? 😄

#8 @prbot
3 weeks ago

ockham commented on PR #2077:

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 weeks ago

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

Self assigning for commit.

#11 @audrasjb
3 weeks 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.