Rendered invalid URLs as plain text when parsing markdown (#3616)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
5937473c5f
Коммит
40c47dcf0b
@@ -139,10 +139,10 @@ class MattermostMarkdownRenderer extends marked.Renderer {
|
|||||||
const unescaped = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
|
const unescaped = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
|
||||||
|
|
||||||
if (unescaped.indexOf('javascript:') === 0 || unescaped.indexOf('vbscript:') === 0 || unescaped.indexOf('data:') === 0) { // eslint-disable-line no-script-url
|
if (unescaped.indexOf('javascript:') === 0 || unescaped.indexOf('vbscript:') === 0 || unescaped.indexOf('data:') === 0) { // eslint-disable-line no-script-url
|
||||||
return '';
|
return text;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return '';
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(/[a-z+.-]+:/i).test(outHref)) {
|
if (!(/[a-z+.-]+:/i).test(outHref)) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user