Opened 6 years ago

Closed 5 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


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

>>> URLField().clean("example.-com")
>>> URLField().clean("")

Change History (3)

comment:1 Changed 6 years ago by Aymeric Augustin

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

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

comment:2 Changed 6 years ago by Adrian Holovaty

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 Changed 5 years ago by Claude Paroz

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