Wednesday, April 30, 2014

regression? validate_email accepts trailing dash

Hi everybody,

I've found this behavior that feels like a bug. I would like your opinion on whether it is a bug.

In django 1.6 an EmailField will accept an address of the form 'foo@bar.com-'
In django 1.4 it would trigger a ValidationError.

Should this be considered a regression?

The way I interpret the email domain name specs foo@bar.com- is technically a valid email address, because bar.com- is technically a valid domain. But in practice there aren't any top level domains with a dash at the end, so this behavior is completely unexpected.

reference:
 * email spec: http://tools.ietf.org/html/rfc2822#section-3.4
 * domain name spec: http://tools.ietf.org/html/rfc1035#section-2.3.1


Tested in both versions like so:
   from django.core.validators import validate_email
   validate_email('foo@bar.com-')


Should I file a bug, do you think?

Thanks
-jason

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d7c5b6c5-6e32-454d-a5f0-e6556c7e2fa2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment