1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

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: https://github.com/mozilla/pdf.js/issues/19462
This commit is contained in:
Ujjwal Sharma 2025-02-10 16:29:43 +01:00
parent a857ca3261
commit 70e2873430
2 changed files with 23 additions and 13 deletions

View file

@ -87,6 +87,9 @@ describe("autolinker", function () {
"CAP.cap@Gmail.Com", // Keep the original case.
"mailto:CAP.cap@Gmail.Com",
],
["partl@mail.boku.ac.at", "mailto:partl@mail.boku.ac.at"],
["Irene.Hyna@bmwf.ac.at", "mailto:Irene.Hyna@bmwf.ac.at"],
["<hi@foo.bar.baz>", "mailto:hi@foo.bar.baz"],
]);
});
@ -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);