Skip to content

Commit

Permalink
Add dots to FQDNs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Kullberg committed Nov 19, 2024
1 parent fdd0127 commit 032093b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions dnstapir/dns/mozpsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,23 @@ def coredomain(self, domain: str) -> tuple[str, str]:
raise ValueError from exc
lbls = domain.split(".")
lbls.reverse()

c, p = self.trie.search(lbls)
core = lbls[0:c]
core.reverse()
pcore = lbls[0:p]
pcore.reverse()
return (".".join(core)+".", ".".join(pcore)+".")
if c != 0:
core = lbls[0:c]
core.reverse()
core_txt = ".".join(core) + "."
else:
core_txt = ""

if p != 0:
pcore = lbls[0:p]
pcore.reverse()
pcore_txt = ".".join(pcore) + "."
else:
pcore_txt = ""

return (core_txt, pcore_txt)

def rdomain(self, rdomain: str) -> tuple[str, str]:
"""Find ICANN and private name cut-off for domain, reverse order process"""
Expand Down

0 comments on commit 032093b

Please sign in to comment.