diff --git a/index.js b/index.js index 815ac03afd8b556697796dc266d4529bcc26a603..78e61972fbb8af11da63d7baad5b3d38a7c979b5 100644 --- a/index.js +++ b/index.js @@ -27,12 +27,12 @@ app.get( '/', function( req, res ) { // Parse POST body to create WP post app.post( '/log', function( req, res ) { // Don't bother if there's nothing to record - if ( 'undefined' === typeof req.body || ! req.body.length ) { + if ( 'undefined' === typeof req.body || 'undefined' === typeof req.body.text || ! req.body.text.length ) { return res.sendStatus( 400 ); } // Massage the title - var title = req.body; + var title = req.body.text; title = striptags( title, [] ); if ( title.length > 30 ) { @@ -43,7 +43,7 @@ app.post( '/log', function( req, res ) { } // Decorate the content - var content = req.body; + var content = req.body.text; content = striptags( content, [ 'a', 'code', 'strong', 'em' ] ); content = '<blockquote>' + content + "</blockquote>\n\n#slash-done";