validatorjs / validator.js

String validation
MIT License
23.12k stars 2.32k forks source link

isEmail is not rejecting when exclamation mark (!) is included #1666

Open jasonlewicki opened 3 years ago

jasonlewicki commented 3 years ago

Describe the bug

the isEmail() method is not validating properly when an exclamation point is included in the string.

To Reproduce

example.hello!@gmail.com await body("email_address").isEmail().run(request);

Expected behavior

a thrown error is expected

Current behavior

returns true

Version

^6.10.0

fedeci commented 3 years ago

(express-validator syntax)

varsubham commented 3 years ago

I think ! is a perfectly valid character in email. In-fact these are bunch of valid characters according to w3resources ! # $ % & ' * + - / = ? ^ _ ` { | } ~

For more information you can check out here: https://www.w3resource.com/javascript/form/email-validation.php

Redaloukil commented 3 years ago

Based on the link mentioned above (https://www.w3resource.com/javascript/form/email-validation.php), the "!" is a valid character, you can test with the validator bellow based on REC-2822 : https://www.w3resource.com/javascript/form/example-javascript-form-validation-email-REC-2822.html?text1=do%21%21%40gmail.com&submit=Submit#

@ezkemboi can this issue be close