Skip to content

Commit

Permalink
Fix domain validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dcwatson committed Apr 30, 2024
1 parent 9e8821d commit ff3fdc4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/users/views/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"example.com",
"www.example.com",
"example.co.uk",
"alektra.local:8000",
]

INVALID_DOMAINS = [
Expand Down
2 changes: 1 addition & 1 deletion users/views/admin/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DomainValidator(RegexValidator):
r"(?<!-)" # can't end with a dash
r"\.?" # may have a trailing dot
)
port_re = r"(?:\:\d+)"
port_re = r"(\:\d+)?"
regex = "^" + hostname_re + domain_re + tld_re + port_re + "$"
message = "This does not look like a domain name"

Expand Down

0 comments on commit ff3fdc4

Please sign in to comment.