diff --git a/awx/conf/fields.py b/awx/conf/fields.py index c5516b7c2e..82a1e2b8a3 100644 --- a/awx/conf/fields.py +++ b/awx/conf/fields.py @@ -1,11 +1,12 @@ # Python import os +import re import logging import urllib.parse as urlparse from collections import OrderedDict # Django -from django.core.validators import URLValidator +from django.core.validators import URLValidator, _lazy_re_compile from django.utils.translation import ugettext_lazy as _ # Django REST Framework @@ -118,17 +119,42 @@ class StringListPathField(StringListField): class URLField(CharField): + # these lines set up a custom regex that allow numbers in the + # top-level domain + tld_re = ( + r'\.' # dot + r'(?!-)' # can't start with a dash + r'(?:[a-z' + URLValidator.ul + r'0-9' + '-]{2,63}' # domain label, this line was changed from the original URLValidator + r'|xn--[a-z0-9]{1,59})' # or punycode label + r'(?