From 579ad305e1b319f07ed48d3a8c749674fdd58133 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 6 Mar 2017 21:20:29 -0500 Subject: [PATCH] PLT-5722 Fix formatText to fail gracefully when input is not text (#5670) * Updated marked to remove incorrect error message * Fix formatText to fail gracefully when input is not text --- webapp/package.json | 2 +- webapp/utils/text_formatting.jsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/package.json b/webapp/package.json index 08ea8a8824..216292f348 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -17,7 +17,7 @@ "intl": "1.2.5", "jasny-bootstrap": "3.1.3", "jquery": "3.1.1", - "marked": "mattermost/marked#328857681dcc98a3d75633d6c0effa7c29b6cceb", + "marked": "mattermost/marked#8f5902fff9bad793cd6c66e0c44002c9e79e1317", "match-at": "0.1.0", "object-assign": "4.1.1", "pdfjs-dist": "1.7.235", diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx index a9e33513c5..7f6101e360 100644 --- a/webapp/utils/text_formatting.jsx +++ b/webapp/utils/text_formatting.jsx @@ -30,6 +30,10 @@ const cjkPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00- // links to the relevant channel. // - team - The current team. export function formatText(text, inputOptions) { + if (!text || typeof text !== 'string') { + return ''; + } + let output = text; const options = Object.assign({}, inputOptions);