Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#22579 closed Bug (fixed)

validate_email accepts trailing dash

Reported by: jason@… Owned by: Erik Romijn
Component: Core (Other) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In django 1.6 an EmailField (validate_email) will accept an address with a trailing dash at the end. Example: 'foo@…-'
In django 1.4 it would trigger a ValidationError, so I believe this is a regression.

Tested like so:

>>> from django.core.validators import validate_email
>>> validate_email('foo@bar.com-')

expected: throws ValidationError
actual: no error thrown

This may be related to #12027, about the same behavior, but with a trailing dot. As with that bug, a trailing dash causes sendmail to throw an error.

Attachments (1)

22579-1.diff (2.3 KB) - added by Claude Paroz 2 years ago.

Download all attachments as: .zip

Change History (7)

Changed 2 years ago by Claude Paroz

Attachment: 22579-1.diff added

comment:1 Changed 2 years ago by Claude Paroz

Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 2 years ago by Tomek Paczkowski

Triage Stage: AcceptedReady for checkin

Tests are good, patch applies.

comment:3 Changed 2 years ago by Erik Romijn

Owner: changed from nobody to Erik Romijn
Status: newassigned

comment:4 Changed 2 years ago by Erik Romijn <eromijn@…>

Resolution: fixed
Status: assignedclosed

In 424fe76349a2e34eafef13c2450a7a1f4d3115a6:

Fixed #22579 -- Corrected validation for email to reject trailing slash

Thanks to Claude Paroz for the report and patch and Tomasz
Paczkowski for the review.

comment:5 Changed 2 years ago by Erik Romijn <eromijn@…>

In 2a66d12e77821fbd4f2e4c3cb93eb9f84ca6f9ab:

[1.7.x] Fixed #22579 -- Corrected validation for email to reject trailing slash

Backport of 424fe76349a2e34eafef13c2450a7a1f4d3115a6 from master.

comment:6 Changed 2 years ago by Erik Romijn <eromijn@…>

In 50a289d05fba760716287d582c7ea19edd1159cc:

[1.6.x] Fixed #22579 -- Corrected validation for email to reject trailing slash

Backport of 424fe76349a2e34eafef13c2450a7a1f4d3115a6 from master.

Note: See TracTickets for help on using tickets.
Back to Top