linkify icon indicating copy to clipboard operation
linkify copied to clipboard

non-breaking space is included as part of e-mail links

Open hamamo opened this issue 1 year ago • 0 comments

Apparently "\u{a0}" is considered part of e-mail links, as shown by this failing test case:

#[test]
fn test_link_finder() {
    let text =
        "this is a mail address:\u{a0}[email protected]\u{a0}surrounded by non-breaking spaces";
    let mut links = LinkFinder::new().links(text);
    assert_eq!(links.next().unwrap().as_str(), "[email protected]");
}

As non-breaking spaces are common in e-mail bodies, this leads to misidentification of links.

hamamo avatar Sep 08 '23 07:09 hamamo