From 86a0677de368719d059d4efe70aec7c2bd97aa7b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 26 Sep 2024 15:41:37 -0500 Subject: [PATCH] Update yarl/_url.py --- yarl/_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarl/_url.py b/yarl/_url.py index 7897b52b1..1fd6c7c6b 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -966,7 +966,7 @@ def _encode_host(cls, host: str, human: bool = False) -> str: raw_ip = host sep = zone = "" - if raw_ip and (":" in raw_ip or raw_ip[-1].isdigit()): + if raw_ip and (raw_ip[-1].isdigit() or ":" in raw_ip): # Might be an IP address, check it # # IP Addresses can look like: