routes/post.js
/**
 * Method will check if given `post` model satisfies security conditions.
 *
 * In case passed `post` model doesn't satisfy security conditions
 * an `HttpError` with status code 400 will be returned.
 *
 * @param {Post} post model
 * @param {Function} callback
 * @return {String} absolute path to post content file
 * @api private
 */
Method will check if given `post` model satisfies security conditions.
In case passed `post` model doesn't satisfy security conditions
an `HttpError` with status code 400 will be returned.

@param {Post} post model
@param {Function} callback
@return {String} absolute path to post content file
@api private
Method will check if given ` post ` model satisfies security conditions . In case passed ` post ` model doesn ' t satisfy security conditions an ` HttpError ` with status code 400 will be returned . @param { Post } post model @param { Function } callback @return { String } absolute path to post content file @api private
function checkPostSecurity(post, cb) {
  var normalizedTitle = post.normalizeTitle(post.title),
    fileName = path.join(contentPath, normalizedTitle + '.md');
  process.nextTick(function () {
    return (fileName.indexOf(contentPath) === 0 && !~fileName.indexOf('\0'))
      && !~fileName.indexOf('new.md')
      ? cb(null) : cb(new HttpError(400));
  });
  return fileName;
}
function checkPostSecurity ( post , cb ) { var normalizedTitle = post . normalizeTitle ( post . title ) , fileName = path . join ( contentPath , normalizedTitle + '.md' ) ; process . nextTick ( function ( ) { return ( fileName . indexOf ( contentPath ) === 0 && ! ~ fileName . indexOf ( '\0' ) ) && ! ~ fileName . indexOf ( 'new.md' ) ? cb ( null ) : cb ( new HttpError ( 400 ) ) ; } ) ; return fileName ; }
Method will check if given `post` model satisfies security conditions.
Method will check if given ` post ` model satisfies security conditions .