diff --git a/server/homebrew.api.js b/server/homebrew.api.js index e934aa803..cc5525ab8 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -11,9 +11,15 @@ const Markdown = require('../shared/naturalcrit/markdown.js'); // }); // }; +const MAX_TITLE_LENGTH = 100; + const getGoodBrewTitle = (text)=>{ const tokens = Markdown.marked.lexer(text); - return title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text; + let title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text; + if(title.length > MAX_TITLE_LENGTH) { + title = title.substr(0, MAX_TITLE_LENGTH); + } + return title; }; const newBrew = (req, res)=>{ @@ -122,8 +128,6 @@ const newGoogleBrew = async (req, res, next)=>{ req.body = brew; - console.log(oAuth2Client); - const newBrew = await GoogleActions.newGoogleBrew(oAuth2Client, brew); return res.status(200).send(newBrew);