Merge pull request #872 from Steffo99/feature/twitter-crash-fix

Fix crash if a `@username@twitter.com` pseudo-mention is encountered
This commit is contained in:
Chee Aun 2024-10-13 08:36:27 +08:00 committed by GitHub
commit 4d03f8fba4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,7 @@ const CODE_BLOCK_END_REGEX = /```$/;
const INLINE_CODE_REGEX = /`[^`]+`/;
const TWITTER_DOMAIN_REGEX = /(twitter|x)\.com/i;
const TWITTER_MENTION_REGEX = /@[a-zA-Z0-9_]+@(twitter|x)\.com/;
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/;
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/g;
function createDOM(html, isDocumentFragment) {
const tpl = document.createElement('template');