diff --git a/valkey/_parsers/url_parser.py b/valkey/_parsers/url_parser.py index b85b18e6..5f26cdd0 100644 --- a/valkey/_parsers/url_parser.py +++ b/valkey/_parsers/url_parser.py @@ -40,10 +40,11 @@ def parse_url(url: str, async_connection: bool): supported_schemes = ["valkey", "valkeys", "redis", "rediss", "unix"] parsed: ParseResult = urlparse(url) kwargs: ConnectKwargs = {} + lower_url = url.lower() pattern = re.compile( - r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://", re.IGNORECASE + r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://" ) - if not pattern.match(url): + if not pattern.match(lower_url) and not lower_url.startswith("unix:"): raise ValueError( f"Valkey URL must specify one of the following schemes {supported_schemes}" )