diff --git a/certbot_dns_infomaniak/dns_infomaniak.py b/certbot_dns_infomaniak/dns_infomaniak.py index fade23d..15296d7 100644 --- a/certbot_dns_infomaniak/dns_infomaniak.py +++ b/certbot_dns_infomaniak/dns_infomaniak.py @@ -213,7 +213,7 @@ def add_txt_record(self, domain, source, target, ttl=300): (domain_id, domain_name) = self._find_zone(domain) logger.debug("%s / %s", domain_id, domain_name) if source.endswith("." + domain_name): - relative_source = source[:source.rfind("." + domain_name)] + relative_source = source[:source.rfind("." + idna.encode(domain_name).decode("ascii"))] else: relative_source = source logger.debug("add_txt_record %s %s %s", domain_name, relative_source, target) @@ -229,7 +229,7 @@ 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): - relative_source = source[:source.rfind("." + domain_name)] + relative_source = source[:source.rfind("." + idna.encode(domain_name).decode("ascii"))] else: relative_source = source records = self._get_records(