Don't auto-add http:// to mailto: and ftp: markdown links

Этот коммит содержится в:
Florian Orben
2015-10-14 20:21:25 +02:00
родитель 830e8b04d9
Коммит b8c80c6d95
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@@ -32,7 +32,7 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
link(href, title, text) { link(href, title, text) {
let outHref = href; let outHref = href;
if (outHref.lastIndexOf('http', 0) !== 0) { if (!(/^(mailto|https?|ftp)/.test(outHref))) {
outHref = `http://${outHref}`; outHref = `http://${outHref}`;
} }

Просмотреть файл

@@ -89,7 +89,7 @@ function autolinkUrls(text, tokens) {
if (match.getType() === 'email') { if (match.getType() === 'email') {
url = `mailto:${url}`; url = `mailto:${url}`;
} else if (url.lastIndexOf('http', 0) !== 0) { } else if (!(/^(mailto|https?|ftp)/.test(url))) {
url = `http://${url}`; url = `http://${url}`;
} }