-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix autolinking errors due to regex and email validation
Fix some edge cases in the autolinking logic with the regex as well as validating email domains and add unit tests for them. Fixes: #19462
- Loading branch information
Showing
2 changed files
with
23 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,9 @@ describe("autolinker", function () { | |
"[email protected]", // Keep the original case. | ||
"mailto:[email protected]", | ||
], | ||
["[email protected]", "mailto:[email protected]"], | ||
["[email protected]", "mailto:[email protected]"], | ||
["<[email protected]>", "mailto:[email protected]"], | ||
]); | ||
}); | ||
|
||
|
@@ -140,6 +143,7 @@ describe("autolinker", function () { | |
"http//[00:00:00:00:00:00", // Invalid IPv6 address. | ||
"http//[]", // Empty IPv6 address. | ||
"abc.example.com", // URL without scheme. | ||
"JD?M$0QP)lKn06l1apKDC@\\qJ4B!!(5m+j.7F790m", // Not a valid email. | ||
].join("\n") | ||
); | ||
expect(matches.length).toEqual(0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters