fixed wrongly parsing link with @ symbol as username

This commit is contained in:
Tony Yang
2019-06-29 23:57:44 +08:00
parent 787c58906e
commit ef220fe537
2 changed files with 6 additions and 2 deletions

View File

@@ -12,9 +12,11 @@ function postProcess(...callbacks) {
function linkSanitize() {
$('.markdown-body a').each((_i, e) => {
href = (e.getAttribute('href')) ? _.unescape(e.getAttribute('href').toLowerCase()) : "";
href = (e.href) ? _.unescape(e.href.toLowerCase()) : "";
if (href.indexOf('javascript:') != -1) {
e.setAttribute('href', '#');
e.href = '#';
} else {
e.href = e.href.replace(/%40/, '@');
}
});
}