Joi: Valid emails are considered invalid

Created on 13 Sep 2019  路  2Comments  路  Source: sideway/joi

Context

  • node version: any
  • joi version: 15.1.1
  • environment (node, browser): any
  • used with (hapi, standalone, ...): hapi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

Trying to validate email printifyapp.com_00000000000000000000000000000000000000000000000000@resource.calendar.google.com using Joi standard .email() and it reports that Email is not valid, while it looks legit and is produced by https://printify.com/.

const schema = Joi.object({
            email: Joi.string().trim().email({tlds: false}).required(),
        });
const { error } = Joi.validate({
    email: 'printifyapp.com_00000000000000000000000000000000000000000000000000@resource.calendar.google.com',
}, schema);

assert.ok(!error, error);

Which result you had ?

ValidationError: child "email" fails because ["email" must be a valid email]

What did you expect ?

No validation errors

bug

Most helpful comment

Use the ignoreLength email option. I forgot to expose it.

All 2 comments

It's not valid according to https://tools.ietf.org/html/rfc5321#section-4.5.3.1.1 (67 > 64).

Use the ignoreLength email option. I forgot to expose it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

farwayer picture farwayer  路  3Comments

normancarcamo picture normancarcamo  路  3Comments

longweiquan picture longweiquan  路  3Comments

leore picture leore  路  4Comments

jamesdixon picture jamesdixon  路  4Comments