diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-14 19:24:24 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-14 19:24:24 -0700 |
commit | d0b25363d144c49631da4c6b17e2493933b10138 (patch) | |
tree | 787a3d3ad46a5368ad9eb2c16f4bfc204cd695f1 | |
parent | 94501476fa2cc59695da4dceafaaa77aa0de89a3 (diff) | |
parent | b8c80c6d9520ec0af0407c576ee565df85fcc41f (diff) | |
download | chat-d0b25363d144c49631da4c6b17e2493933b10138.tar.gz chat-d0b25363d144c49631da4c6b17e2493933b10138.tar.bz2 chat-d0b25363d144c49631da4c6b17e2493933b10138.zip |
Merge pull request #1053 from florianorben/markown_fix
Don't auto-add http:// to mailto: and ftp: markdown links
-rw-r--r-- | web/react/utils/markdown.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/text_formatting.jsx | 2 |
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}`; } |