[wp-trac] [WordPress Trac] #43177: REST API allows empty comments containing only whitespace

WordPress Trac noreply at wordpress.org
Mon Jan 29 16:28:08 UTC 2018


#43177: REST API allows empty comments containing only whitespace
--------------------------+-----------------------------
 Reporter:  jaswrks       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 I can POST the following to the REST API endpoint for comments and it
 slides through so long as it's not an empty string. Just adding a single
 space results in an empty comment.

 {{{
 {
         "post": 1,
         "content": " "
 }
 }}}

 I suggest `trim()` empty check. Or, a more robust alternative:
 https://gist.github.com/jaswrks/d662f4ba8b379e7602c8f80f7b1bb82e

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


More information about the wp-trac mailing list