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

WordPress Trac noreply at wordpress.org
Wed Oct 7 20:31:02 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:  REST API       |     Version:  5.5
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------
Changes (by TimothyBlynJacobs):

 * severity:  major => normal


Comment:

 Thanks for the ticket @nielsdeblaauw!

 Testing just the plain pattern `[^.\/]+(?:\/[^.\/]+)?` and
 `?<plugin>[^.\/]+(?:\/[^.\/]+)?)`. It appears to compile successfully for
 me in both Safari 14 and Node 12.

 It looks like this might be an artifact of how `node-wpapi` handles
 transforming the route regex.

 This, `new RegExp(/^[^.\/]+(?:\/[^.\/]+$/);` for instance should actually
 be `new RegExp(/^[^.\/]+(?:\/[^.\/]+)?$/);` which does compile
 successfully. Notice that the `)?` was dropped.

 Cc: @kadamwhite.

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


More information about the wp-trac mailing list