Opened 5 years ago

Closed 5 years ago

#15014 closed (duplicate)

URLField validator regex does not allow valid domain name

Reported by: posta07 Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

For internal urls that I would like to enter into an URLField, I found that the regex that the validator uses flags the url as incorrect even though it is a valid URL.

For exmaple, http://servername/context/context/etc/ is flagged as incorrect. After reviewing the regex that's being used, it appears it's expecting a .com or .biz or some kind of extension.

Here is the regex related to testing for the 'domain':

(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?

As you can see, it expects a period character in the domain name followed by a 2-6 character length extension.

Change History (1)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #9202.

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