[wp-trac] [WordPress Trac] #59635: Revise the regular expressions defining endpoints for template revisions, template autosaves, template part revisions, and template part autosaves endpoints

WordPress Trac noreply at wordpress.org
Mon Oct 16 17:39:10 UTC 2023


#59635: Revise the regular expressions defining endpoints for template revisions,
template autosaves, template part revisions, and template part autosaves
endpoints
---------------------------+-----------------------------
 Reporter:  antonvlasenko  |      Owner:  antonvlasenko
     Type:  enhancement    |     Status:  assigned
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  REST API       |    Version:  trunk
 Severity:  normal         |   Keywords:  needs-patch
  Focuses:  rest-api       |
---------------------------+-----------------------------
 Currently known issues:

 1. The controllers expect the `template_id` and `template_part_id` to
 always follow the format `theme_name//<template(_part)_name>`. In
 practice, it's not possible to retrieve a template or template part using
 only their template name (i.e., `post_name`). The `get_block_template()`
 function, employed by both REST controllers, presumes that the ID is
 divided into two parts separated by `//`. The theme's name must always be
 included in the request alongside the template (part) name.

 2. The controllers also should not accept URLs that consist of more than
 two parts; for example,
 `theme_name//<template(_part)_name//some_arbitrary_value` shouldn't be
 allowed. (props @ironprogrammer).

 3. Inline comments in the controller classes need to be fixed to correctly
 reflect the format of accepted URLs.

 4. Unit tests need to be added to cover the cases mentioned above.

 Follow-up from https://core.trac.wordpress.org/ticket/56922 and
 https://github.com/WordPress/wordpress-develop/pull/3533.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59635>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list