Opened 14 years ago
Closed 14 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: | no | UI/UX: | no |
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.
Duplicate of #9202.