Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#54680 closed defect (bug) (fixed)

Site Editor: Adding 404 template causes rest_invalid_pattern

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

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 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:


5 years ago
#2

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

#3 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review → 5.9

​SergeyBiryukov commented on ​PR #2077:


5 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:


5 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
5 years ago

  • Keywords has-unit-tests commit added

Ready for commit.

​ockham commented on ​PR #2077:


5 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:


5 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
5 years ago

  • Owner set to audrasjb
  • Status new → accepted

Self assigning for commit.

#11 @audrasjb
5 years ago

  • Resolution → fixed
  • Status accepted → 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.