Opened 13 years ago

Closed 12 years ago

#18178 closed Bug (wontfix)

URLField -- TLD part can not start/end with hyphen

Reported by: Miloslav Pojman Owned by: nobody
Component: Forms Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

URLField accepts URLs where a TLD part of the domain name starts or ends with a hyphen.

>>> URLField().clean("example.-com")
u'http://example.-com/'
>>> URLField().clean("example.com-")
u'http://example.com-/'

Change History (3)

comment:1 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedDesign decision needed

The concept of what is and what isn't an URL isn't very well defined. The regexp given by the RFC matches absolutely anything (see https://code.djangoproject.com/ticket/9202#comment:4).

I'm not excited by the idea of tweaking the current validation...

comment:2 by Adrian Holovaty, 12 years ago

Our implementation uses Python's urlparse.urlsplit(), which allows that. Not sure whether that should be considered a bug in the Python standard library.

comment:3 by Claude Paroz, 12 years ago

Resolution: wontfix
Status: newclosed

I think the current validation is already doing a good job. Reopen if a you can provide a patch which doesn't complicate things too much.

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