mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Don't auto-add http:// to mailto: and ftp: markdown links
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user