Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LABEL_INVALID_CHARACTER for a legitimate URL #141

Closed
peterjoles opened this issue Mar 8, 2022 · 2 comments
Closed

LABEL_INVALID_CHARACTER for a legitimate URL #141

peterjoles opened this issue Mar 8, 2022 · 2 comments

Comments

@peterjoles
Copy link

The following URL cannot be parsed because it has an underscore in the subdomain.

const parseResult = parseDomain(fromUrl("https://stackadapt_public.s3.amazonaws.com/icons/adchoices/adchoices.png"));

https://stackoverflow.com/questions/2180465/can-domain-name-subdomains-have-an-underscore-in-it

@jhnns
Copy link
Member

jhnns commented Mar 9, 2022

Hi Peter 👋

we talked about this issue in #134

There's a debate whether underscores are valid or not 😁. If you want/need to support it, you can relax the validation:

import { parseDomain, Validation } from "parse-domain";

const parseResult = parseDomain("_jabber._tcp.gmail.com", {
  validation: Validation.Lax,
});

See also https://github.com/peerigon/parse-domain#-export-validation

@jhnns jhnns closed this as completed Mar 9, 2022
@peterjoles
Copy link
Author

That's great to know. Thanks for following up. I'll try and relax the validations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants