summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/markdown.jsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/webapp/utils/markdown.jsx b/webapp/utils/markdown.jsx
index 7f597eb3d..0b279ca6d 100644
--- a/webapp/utils/markdown.jsx
+++ b/webapp/utils/markdown.jsx
@@ -135,7 +135,13 @@ class MattermostMarkdownRenderer extends marked.Renderer {
let outHref = href;
try {
- const unescaped = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
+ let unescaped = unescape(href);
+ try {
+ unescaped = decodeURIComponent(unescaped);
+ } catch (e) {
+ unescaped = global.unescape(unescaped);
+ }
+ unescaped = unescaped.replace(/[^\w:]/g, '').toLowerCase();
if (unescaped.indexOf('javascript:') === 0 || unescaped.indexOf('vbscript:') === 0 || unescaped.indexOf('data:') === 0) { // eslint-disable-line no-script-url
return text;