Skip to content

Commit 65b5c04

Browse files
committed
Allow relative path in unix socket URLs
Close #123 Signed-off-by: Salvatore Mesoraca <[email protected]>
1 parent 02c2bfe commit 65b5c04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

valkey/_parsers/url_parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ def parse_url(url: str, async_connection: bool):
4040
supported_schemes = ["valkey", "valkeys", "redis", "rediss", "unix"]
4141
parsed: ParseResult = urlparse(url)
4242
kwargs: ConnectKwargs = {}
43+
lower_url = url.lower()
4344
pattern = re.compile(
44-
r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://", re.IGNORECASE
45+
r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://"
4546
)
46-
if not pattern.match(url):
47+
if not pattern.match(lower_url) and not lower_url.startswith("unix:"):
4748
raise ValueError(
4849
f"Valkey URL must specify one of the following schemes {supported_schemes}"
4950
)

0 commit comments

Comments
 (0)