Merge "fix: Validate length of domain in get_service_by_domain"
This commit is contained in:
commit
e18e44e2cb
@ -393,6 +393,14 @@ def is_valid_domain_by_name(domain_name):
|
||||
# shared ssl domain
|
||||
shared_ssl_domain_regex = '^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]?$'
|
||||
|
||||
if len(domain_name) > 253:
|
||||
raise exceptions.ValidationFailed(
|
||||
u'Domain {0} is too long'.format(domain_name))
|
||||
|
||||
if len(domain_name) < 3:
|
||||
raise exceptions.ValidationFailed(
|
||||
u'Domain {0} is too short'.format(domain_name))
|
||||
|
||||
if not re.match(domain_regex, domain_name):
|
||||
if not re.match(shared_ssl_domain_regex, domain_name):
|
||||
raise exceptions.ValidationFailed(
|
||||
|
@ -165,7 +165,7 @@ class TestGetServiceByDomain(base.TestBase):
|
||||
"_long_name_too_long_name_too_long_name_too_long_name_too_" \
|
||||
"long_name.com"
|
||||
resp = self.operator_client.admin_get_service_by_domain_name(domain)
|
||||
self.assertEqual(resp.status_code, 404)
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.delete_service(location=self.service_url)
|
||||
|
Loading…
Reference in New Issue
Block a user