url checking suitable for yggdrassil address

main
bashrc 2026-02-23 14:20:21 +00:00
parent 594d08cc6d
commit 3fcf7e702c
1 changed files with 2 additions and 1 deletions

View File

@ -3953,7 +3953,8 @@ def get_reply_to(post_json_object: {}) -> str:
def resembles_url(text: str) -> bool:
"""Does the given text look like a url?
"""
if '://' in text and '.' in text and \
if '://' in text and \
('.' in text or ('[' in text and ']' in text and ':' in text)) and \
' ' not in text and '<' not in text:
return True
return False