summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorFlorian Orben <florian.orben@gmail.com>2015-10-14 20:21:25 +0200
committerFlorian Orben <florian.orben@gmail.com>2015-10-14 21:44:09 +0200
commitb8c80c6d9520ec0af0407c576ee565df85fcc41f (patch)
tree3e9f0c381371dc22bd3190afa7284ce0c8191072 /web
parent830e8b04d9cbc5652ab8b23d469e1c75ff5f8516 (diff)
downloadchat-b8c80c6d9520ec0af0407c576ee565df85fcc41f.tar.gz
chat-b8c80c6d9520ec0af0407c576ee565df85fcc41f.tar.bz2
chat-b8c80c6d9520ec0af0407c576ee565df85fcc41f.zip
Don't auto-add http:// to mailto: and ftp: markdown links
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}`;
}