Support mailto emails.
GitOrigin-RevId: aca706aee9b1adb34f3f25700e91cd0d0880424f
This commit is contained in:
parent
28ddc0525c
commit
a365284831
@ -1011,6 +1011,8 @@ vector<std::pair<Slice, bool>> find_urls(Slice str) {
|
||||
for (auto url : match_urls(str)) {
|
||||
if (is_email_address(url)) {
|
||||
result.emplace_back(url, true);
|
||||
} else if (begins_with(url, "mailto:") && is_email_address(url.substr(7))) {
|
||||
result.emplace_back(url.substr(7), true);
|
||||
} else {
|
||||
url = fix_url(url);
|
||||
if (!url.empty()) {
|
||||
|
@ -515,6 +515,7 @@ TEST(MessageEntities, url) {
|
||||
check_url("<http://www.ics.uci.edu/pub/ietf/uri/historical.html#WARNING>",
|
||||
{"http://www.ics.uci.edu/pub/ietf/uri/historical.html#WARNING"});
|
||||
check_url("Look :test@example.com", {":test@example.com"}, {}); // TODO {}, {"test@example.com"}
|
||||
check_url("Look mailto:test@example.com", {}, {"test@example.com"});
|
||||
check_url("http://test.com#a", {"http://test.com#a"});
|
||||
check_url("http://test.com#", {"http://test.com#"});
|
||||
check_url("http://test.com?#", {"http://test.com?#"});
|
||||
|
Loading…
Reference in New Issue
Block a user