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

isFQDN function continues executing with disabled require_tld option #2425

Open
mdss-single opened this issue Jun 20, 2024 · 2 comments
Open
Labels

Comments

@mdss-single
Copy link

Describe the bug
The email is invalid if domain part is bigger than 63 symbols

Examples

// Current behaviour:
const email = test@1234567890123456789012345678901234567890123456789012345678901234.com;
console.log(validator.isEmail(email, {require_tld: false})); // => false

// Expected behaviour:
const email = test@1234567890123456789012345678901234567890123456789012345678901234.com;
console.log(validator.isEmail(email, {require_tld: false})); // => true

Additional context
Validator.js version: 13.12.0
Node.js version: 18.18.0
OS platform: macOS

@mdss-single mdss-single changed the title isFQDN function continue executing with disabled require_tld option isFQDN function continues executing with disabled require_tld option Jun 20, 2024
@arjitcodes
Copy link

For your expected behaviour you need to add option "ignore_max_length" with value "true"

// After add {gnore_max_length: true} :
const email = test@1234567890123456789012345678901234567890123456789012345678901234.com;
console.log(validator.isEmail(email, {require_tld: false, ignore_max_length: true})); // => true

@mdss-single
Copy link
Author

For your expected behaviour you need to add option "ignore_max_length" with value "true"

// After add {gnore_max_length: true} :
const email = test@1234567890123456789012345678901234567890123456789012345678901234.com;
console.log(validator.isEmail(email, {require_tld: false, ignore_max_length: true})); // => true

In this case, that part of the code would be unreachable. My main idea is to validate the email according to the RFC standard, but with any configuration, it is impossible

  if (options.ignore_max_length === false && (
    !isByteLength(user, { max: 64 }) ||
    !isByteLength(domain, { max: 254 }))
  ) {
    return false;
  }

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

No branches or pull requests

2 participants