Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#22579 closed Bug (fixed)

validate_email accepts trailing dash

Reported by: jason@… Owned by: erikr
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 claudep 11 months ago.

Download all attachments as: .zip

Change History (7)

Changed 11 months ago by claudep

comment:1 Changed 11 months ago by claudep

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 11 months ago by oinopion

  • Triage Stage changed from Accepted to Ready for checkin

Tests are good, patch applies.

comment:3 Changed 11 months ago by erikr

  • Owner changed from nobody to erikr
  • Status changed from new to assigned

comment:4 Changed 11 months ago by Erik Romijn <eromijn@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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 11 months 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 11 months 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