summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/markdown.jsx2
-rw-r--r--web/react/utils/text_formatting.jsx2
2 files changed, 2 insertions, 2 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 12d6dd424..2813798d2 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -32,7 +32,7 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
link(href, title, text) {
let outHref = href;
- if (outHref.lastIndexOf('http', 0) !== 0) {
+ if (!(/^(mailto|https?|ftp)/.test(outHref))) {
outHref = `http://${outHref}`;
}
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 2b6e6e14e..d79aeed68 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -89,7 +89,7 @@ function autolinkUrls(text, tokens) {
if (match.getType() === 'email') {
url = `mailto:${url}`;
- } else if (url.lastIndexOf('http', 0) !== 0) {
+ } else if (!(/^(mailto|https?|ftp)/.test(url))) {
url = `http://${url}`;
}