Autolinker.js icon indicating copy to clipboard operation
Autolinker.js copied to clipboard

Subdomains with underscores are not identified as links

Open haugstrup opened this issue 6 years ago • 3 comments

This is related to #277 in that it's an issue with getDomainNameStr in regex-lib.ts.

Subdomain names are treated pretty lax out in the wild. It's common to see subdomains with underscores, but autolinker won't identify these links.

For example: http://_foo.example.com will identify foo.example.com as the link. And http://foo_bar.example.com will identify two links (http://foo and bar.example.com).

@gregjacobs Do you have any general hints on how to target subdomains separately from the normal domain name in getDomainNameStr? I can make the changes and write tests, but I'm having some trouble parsing the current logic.

haugstrup avatar Dec 20 '19 21:12 haugstrup

Have the same problem

pavholm avatar Nov 26 '20 17:11 pavholm

I have the same problem, links with underscores break into multiple parts.

http://faq_for_users.domain.com -> converts into three parts, (faq and users.domain.com like links, and _for_ like plain text);

@gregjacobs Do you have any idea how to fix this problem? Maybe you can point out the origin of this problem.

@haugstrup Have you invented a workaround? Can you share it?

Zheleznyak-F avatar Feb 01 '22 17:02 Zheleznyak-F

Hey, just wanted to point out that this PR should address this issue. So if possible, @gregjacobs could review and merge it. Thank you.

vickz84259 avatar Apr 12 '22 09:04 vickz84259