Skip to content

Commit

Permalink
fix incomplete last commit/pullrequest (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Fuechslein <info@fuechslein.ch>
  • Loading branch information
Fuechslein and Fuechslein authored Jan 5, 2022
1 parent 8ce0ec7 commit dec7075
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions certbot_dns_infomaniak/dns_infomaniak.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def add_txt_record(self, domain, source, target, ttl=300):
logger.debug("add_txt_record %s %s %s", domain, source, target)
(domain_id, domain_name) = self._find_zone(domain)
logger.debug("%s / %s", domain_id, domain_name)
if source.endswith("." + domain_name):
if source.endswith("." + idna.encode(domain_name).decode("ascii")):
relative_source = source[:source.rfind("." + idna.encode(domain_name).decode("ascii"))]
else:
relative_source = source
Expand All @@ -228,10 +228,11 @@ def del_txt_record(self, domain, source, target):
"""
logger.debug("del_txt_record %s %s %s", domain, source, target)
(domain_id, domain_name) = self._find_zone(domain)
if source.endswith("." + domain_name):
if source.endswith("." + idna.encode(domain_name).decode("ascii")):
relative_source = source[:source.rfind("." + idna.encode(domain_name).decode("ascii"))]
else:
relative_source = source
logger.debug("del_txt_record %s %s %s", domain_name, relative_source, target)
records = self._get_records(
domain_name, domain_id,
{"type": "TXT", "source": relative_source, "target": target},
Expand Down

0 comments on commit dec7075

Please sign in to comment.