[wp-trac] [WordPress Trac] #58132: Slashes used in block templates slug is a problem on Windows

WordPress Trac noreply at wordpress.org
Fri Apr 14 11:26:34 UTC 2023


#58132: Slashes used in block templates slug is a problem on Windows
-------------------------+-----------------------------
 Reporter:  gaft         |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  6.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Generally, they are all stored flat in the theme `templates` or `block-
 templates` folder; we have no problem here. But when they are stored deep
 under some folder/s, the slug checks won't pass on Windows.

 This is because finding the template paths
 [https://developer.wordpress.org/reference/functions/_get_block_templates_paths]
 return backslashes `\` and
 [https://core.trac.wordpress.org/browser/tags/6.2/src/wp-includes/block-
 template-utils.php#L313] currently only does `substr` extracts to come up
 with a slug that is passed to
 [https://developer.wordpress.org/reference/functions/_build_block_template_result_from_file/],
 which eventually fails line
 [https://core.trac.wordpress.org/browser/tags/6.2/src/wp-includes/block-
 template-utils.php#L981] as the slugs in the query are using forward
 slashes `\`.

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


More information about the wp-trac mailing list