[wp-trac] [WordPress Trac] #54596: Block theme with period in name causes blank editor

WordPress Trac noreply at wordpress.org
Mon Dec 20 13:50:52 UTC 2021

#54596: Block theme with period in name causes blank editor
 Reporter:  mkaz                                 |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.9
Component:  REST API                             |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-testing-info needs-testing has-  |     Focuses:
  patch                                          |

Comment (by hellofromTonya):

 [52376] was too limiting as valid directory name characters such as `é`,
 `&`, `=`, `#`, `!`, `$`, `,`, `^`, `~`, `%`, etc.

 Notice that the original regex for listing themes global styles excludes
 `.` and `/` characters.

 '/' . $this->rest_base . '/themes/(?P<stylesheet>[^.\/]+(?:\/[^.\/]+)?)'

 Aha, `.` was being excluded.

 Then @TimothyBlynJacobs asked if `WP_REST_Themes_Controller::PATTERN` was
 also too limiting:
 >Sorry noticed something, does this not affect the themes endpoint? Is
 that regex already broad enough?
 Here's it original regex:
 const PATTERN = '[^.\/]+(?:\/[^.\/]+)?';

 Notice again the `.` character is excluded.

 [https://github.com/WordPress/wordpress-develop/pull/2064 PR 2064] reverts
 the regex changes made by [52376], removes the `.` from the exclusion
 lists, and adds additional invalid characters (invalid on Windows). It
 then adds additional tests to further validate the changes.

 @costdev tested it on Windows. I tested it on Mac. Works well on both.
 Test report is coming.

Ticket URL: <https://core.trac.wordpress.org/ticket/54596#comment:39>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list