[wp-trac] [WordPress Trac] #51467: Plugins API endpoint regex breaks javascript parsing.

WordPress Trac noreply at wordpress.org
Wed Oct 7 12:47:36 UTC 2020


#51467: Plugins API endpoint regex breaks javascript parsing.
---------------------------+-----------------------------
 Reporter:  nielsdeblaauw  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:  5.5
 Severity:  major          |   Keywords:
  Focuses:  rest-api       |
---------------------------+-----------------------------
 The plugin endpoint `/wp/v2/plugins/(?P<plugin>[^.\/]+(?:\/[^.\/]+)?)`
 added in 5.5 breaks JavaScript parsing of the regular expression.


 This can be tested by adding the following into the console:
 `new RegExp(/^[^.\/]+(?:\/[^.\/]+$/);`

 Which results in:
 `VM90:1 Uncaught SyntaxError: Invalid regular expression:
 /^[^.\/]+(?:\/[^.\/]+$/: Unterminated group at <anonymous>:1:1`


 One of the effects is that the node-wpapi library can no longer
 autodiscover WordPress endpoints: https://github.com/WP-API/node-
 wpapi/issues/476

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


More information about the wp-trac mailing list