Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate wildcard domain without re-setting domain #38

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions simple_acme_dns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,9 @@ def __validate_domains__(self) -> None:
msg = "Domains must be rtype 'list'."
raise errors.InvalidDomain(msg)
for domain in self.domains:
if domain[:2] == "*.":
# If wildcard domain, strip of the wildcard to validate domain
domain = domain[2:]
if not validators.domain(domain):
# If wildcard domain, strip of the wildcard to validate domain
domain_to_validate = domain[2:] if domain[:2] == "*." else domain
if not validators.domain(domain_to_validate):
msg = f"Invalid domain name '{domain}'. Domain name must adhere to RFC2181."
raise errors.InvalidDomain(msg)

Expand Down