summaryrefslogtreecommitdiffstats
path: root/webapp/utils/text_formatting.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-03-06 21:20:29 -0500
committerChristopher Speller <crspeller@gmail.com>2017-03-06 21:20:29 -0500
commit579ad305e1b319f07ed48d3a8c749674fdd58133 (patch)
tree71c36af977625607894f33cc7ebe07ffb6c1081b /webapp/utils/text_formatting.jsx
parente87f5c6cf912a4f650a056ee042f19268963177d (diff)
downloadchat-579ad305e1b319f07ed48d3a8c749674fdd58133.tar.gz
chat-579ad305e1b319f07ed48d3a8c749674fdd58133.tar.bz2
chat-579ad305e1b319f07ed48d3a8c749674fdd58133.zip
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
Diffstat (limited to 'webapp/utils/text_formatting.jsx')
-rw-r--r--webapp/utils/text_formatting.jsx4
1 files changed, 4 insertions, 0 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index a9e33513c..7f6101e36 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);