lib: don't prepend mailto to url in autolink Event

better to provide the original url, the event is already tagged as email

also avoids a string allocation
This commit is contained in:
Noah Hellman 2023-03-19 13:32:06 +01:00
parent 62e73100a6
commit 05a4992d99
2 changed files with 8 additions and 4 deletions

View file

@ -746,10 +746,10 @@ impl<'s> Parser<'s> {
}
inline::Container::Autolink => {
let url = self.inlines.src(inline.span);
let (url, ty) = if url.contains('@') {
(format!("mailto:{}", url).into(), LinkType::Email)
let ty = if url.contains('@') {
LinkType::Email
} else {
(url, LinkType::AutoLink)
LinkType::AutoLink
};
Container::Link(url, ty)
}