diff --git a/rendercv/data_model.py b/rendercv/data_model.py index 0f31acc..a066b7b 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -1057,12 +1057,11 @@ class Connection(BaseModel): value: str @staticmethod - def is_valid_fqdn(hostname: str) -> bool: - """Is hostname a valid fully qualified domain name.""" + def is_valid_hostname(hostname: str) -> bool: + """Is hostname a valid hostname by RFCs 952 and 1123""" - # cribbed from + # slightly modified from # https://stackoverflow.com/a/33214423/1304076 - # because I couldn't find a useful method in dnspython. if hostname[-1] == ".": # strip exactly one dot from the right, if present hostname = hostname[:-1] @@ -1071,7 +1070,7 @@ class Connection(BaseModel): labels = hostname.split(".") - # the TLD must be not all-numeric + # the last label must be not all-numeric if re.match(r"[0-9]+$", labels[-1]): return False @@ -1113,7 +1112,8 @@ class Connection(BaseModel): # MENTION_RE = %r{(?