From 6991e535a11a22717509ff23e84d78d3dde8ec8f Mon Sep 17 00:00:00 2001 From: bashrc Date: Thu, 16 Apr 2026 11:10:33 +0100 Subject: [PATCH] Allow . within nicknames --- tests.py | 3 +++ utils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests.py b/tests.py index 4520073c4..100314a03 100644 --- a/tests.py +++ b/tests.py @@ -5238,6 +5238,9 @@ def _test_valid_nick(): nickname = '你好' assert not valid_nickname(domain, nickname) + nickname = 'abc.def' + assert valid_nickname(domain, nickname) + def _test_guess_tag_category() -> None: print('test_guess_hashtag_category') diff --git a/utils.py b/utils.py index bdb97181f..b3e31f502 100644 --- a/utils.py +++ b/utils.py @@ -2567,7 +2567,7 @@ def _is_valid_language(text: str) -> bool: for _, lang_range in natural_languages.items(): ok_lang = True for char in text: - if char.isdigit() or char == '_': + if char.isdigit() or char == '_' or char == '.': continue if ord(char) not in range(lang_range[0], lang_range[1]): ok_lang = False @@ -3311,7 +3311,7 @@ def valid_hash_tag(hashtag: str) -> bool: if len(hashtag) >= 32: return False # numbers are not permitted to be hashtags - if hashtag.isdigit(): + if hashtag.isdigit() or '.' in hashtag: return False if set(hashtag).issubset(VALID_HASHTAG_CHARS): return True