linkifyjs icon indicating copy to clipboard operation
linkifyjs copied to clipboard

Mailto links: invalid email address trailing part should not be linkified

Open vincent-vignaud opened this issue 2 months ago • 0 comments

For example, mailto:[email protected]:123 is linkified (linkifyjs/string) as: <a href="mailto:[email protected]:123" class="linkified">mailto:[email protected]:123</a>.

The value of the href attribute and the value of the text node both contain an invalid email address [email protected]:123.

Since the colon character : is not allowed* in the domain part of the address (unless being an IP address between brackets), the part :123 should not appear in the href attribute nor in the text node.

Same issue with other invalid characters*, for example mailto:[email protected]<123 becomes <a href="mailto:[email protected]<123" class="linkified">mailto:[email protected]&lt;123</a>.

Refs*

  • https://www.rfc-editor.org/rfc/rfc6068
  • https://www.rfc-editor.org/rfc/rfc5322

Note: great job for this lib by the way!

vincent-vignaud avatar Oct 30 '25 10:10 vincent-vignaud