fix: reject GFM email autolink when the domain ends in _ or - (#4063)

This commit is contained in:
Jawad Ali
2026-09-03 23:59:56 -06:00
committed by GitHub
parent 37b28d8f64
commit df57534194
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -531,7 +531,7 @@ const inlineGfm: Record<InlineKeys, RegExp> = {
delRDelim,
url: edit(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/)
.replace('protocol', _caseInsensitiveProtocol)
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/)
.getRegex(),
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
@@ -0,0 +1,2 @@
<p>foo@bar.com_</p>
<p>foo@bar.com-</p>
@@ -0,0 +1,6 @@
---
gfm: true
---
foo@bar.com_
foo@bar.com-