mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2025-06-05 21:59:23 +02:00
More thorough URL checks
This commit is contained in:
@ -24,7 +24,7 @@ class InvalidURLError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
@functools.lru_cache
|
||||
@functools.lru_cache(maxsize=256)
|
||||
def _getaddrinfo(hostname: str, port: int) -> str:
|
||||
try:
|
||||
ip_address = str(ipaddress.ip_address(hostname))
|
||||
@ -65,7 +65,7 @@ def is_url_valid(url: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def check_url(url: str, debug: bool = False) -> None:
|
||||
def check_url(url: str) -> None:
|
||||
logger.debug(f"check_url {url=}")
|
||||
if not is_url_valid(url):
|
||||
raise InvalidURLError(f'"{url}" is invalid')
|
||||
|
Reference in New Issue
Block a user